■ Control 엘리먼트의 Background 속성에서 null과 Transparent 값 설정시 차이점을 비교한다.
▶ 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 |
<Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="800" Height="600" Title="Control 엘리먼트 : Background 속성에서 null과 Transparent 값 설정시 차이점 비교하기" FontFamily="나눔고딕코딩" FontSize="16"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="300" /> <ColumnDefinition Width="10" /> <ColumnDefinition Width="300" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="300" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid Grid.Row="1" Grid.Column="1"> <Label Name="label1" ToolTip="{Binding ElementName=label1,Path=Content}" Content="배경 null 설정 툴팁이 표시된다." /> <Border Width="300" Height="300" BorderBrush="Blue" BorderThickness="2" SnapsToDevicePixels="True" Background="{x:Null}" /> </Grid> <Grid Grid.Row="1" Grid.Column="3"> <Label Name="label2" ToolTip="{Binding ElementName=label2,Path=Content}" Content="배경 Transparent 설정 툴팁이 표시되지 않는다." /> <Border Width="300" Height="300" BorderBrush="Red" BorderThickness="2" SnapsToDevicePixels="True" Background="Transparent" /> </Grid> </Grid> </Window> |