■ 복합 포맷팅을 통해 표시 값을 포맷하는 방법을 보여준다.
▶ 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 72 73 74 75 |
<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" Header="Composite Formatting" Padding="10" FontSize="16"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Label x:Name="orderLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="0 0 5 0" Content="Order" /> <dxe:TextEdit x:Name="orderTextEdit" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" DisplayFormatString="ID {0}" Text="00075" /> <Label x:Name="inStockLabel" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="0 0 5 0" Content="In Stock" /> <dxe:SpinEdit Name="inStockSpinEdit" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" DisplayFormatString="{}{0} units" AllowNullInput="True" NullText="(null)"> <dxe:SpinEdit.EditValue> 349.99 </dxe:SpinEdit.EditValue> </dxe:SpinEdit> <Label x:Name="discountLabel" Grid.Row="2" Grid.Column="0" Margin="0 0 5 0" VerticalAlignment="Center" Content="Discount" /> <dxe:SpinEdit Name="discountSpinEdit" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" DisplayFormatString="p0"> <dxe:SpinEdit.EditValue> 0.15 </dxe:SpinEdit.EditValue> </dxe:SpinEdit> <Label x:Name="shipDateLabel" Grid.Row="3" Grid.Column="0" Margin="0 0 5 0" VerticalAlignment="Center" Content="Ship Date" /> <dxe:DateEdit Name="shipDateDateEdit" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" AllowSpinOnMouseWheel="True" DisplayFormatString="By {0}"> <dxe:DateEdit.EditValue> 10/10/2010 </dxe:DateEdit.EditValue> </dxe:DateEdit> </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 } } |