■ 표준 포맷 지정자를 통해 표시 값을 포맷하는 방법을 보여준다.
▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
<Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" SizeToContent="WidthAndHeight" Title="표준 포맷 지정자를 통해 표시 값 포맷하기" FontFamily="나눔고딕코딩" FontSize="16"> <Grid Margin="10"> <dxlc:GroupBox x:Name="groupBox" FontSize="16" Header="Standard Specifiers" Padding="10"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <Label x:Name="currencyLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="0 0 5 0" Content="Currency" /> <dxe:SpinEdit x:Name="currencySpinEdit" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" DisplayFormatString="c2"> <dxe:SpinEdit.EditValue> 349.99 </dxe:SpinEdit.EditValue> </dxe:SpinEdit> <Label x:Name="scientificLabel" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="0 0 5 0" Content="Scientific" /> <dxe:SpinEdit x:Name="scientificSpinEdit" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" DisplayFormatString="e1" MaskType="None"> <dxe:SpinEdit.EditValue> 12345 </dxe:SpinEdit.EditValue> </dxe:SpinEdit> <Label x:Name="shortDateLabel" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0 0 5 0" Content="Short Date" /> <dxe:DateEdit x:Name="shortDateDateEdit" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" DisplayFormatString="d" EditValue="2014-03-13" /> <Label x:Name="fullDateTimeLabel" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Margin="0 0 5 0" Content="Full Date-Time" /> <dxe:DateEdit x:Name="fullDateTimeDateEdit" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" DisplayFormatString="F" Mask="dd, MMMM, yyyy hh:mm tt" EditValue="10 September 2010 10:00 AM" /> </Grid> </dxlc:GroupBox> </Grid> </Window> |
▶ MainWindow.xaml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
using System.Windows; namespace TestProject { /// <summary> /// 메인 윈도우 /// </summary> public partial class MainWindow : Window { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainWindow() /// <summary> /// 생성자 /// </summary> public MainWindow() { InitializeComponent(); } #endregion } } |