728x90
반응형
728x170
▶ MainWindow.xaml
<Window x:Class="TestProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:TestProject"
Width="800"
Height="600"
Title="ObjectDataProvider 엘리먼트 : Colors 클래스의 색상 정적 속성 구하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Window.Resources>
<ObjectDataProvider x:Key="ColorsTypeObjectDataProviderKey"
ObjectType="{x:Type sys:Type}"
MethodName="GetType">
<ObjectDataProvider.MethodParameters>
<sys:String>
System.Windows.Media.Colors, PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
</sys:String>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="ColorsPropertyObjectDataProviderKey"
ObjectInstance="{StaticResource ColorsTypeObjectDataProviderKey}"
MethodName="GetProperties" />
</Window.Resources>
<Grid>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
BorderThickness="1"
BorderBrush="Black">
<Rectangle Name="rectangle">
<Rectangle.Fill>
<local:CustomBrush x:Name="customBrush" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="그라디언트" />
<ListBox Name="colorListBox" Grid.Row="1"
Margin="0 10 0 0">
<ListBox.ItemTemplate>
<DataTemplate>
<Rectangle
HorizontalAlignment="Center"
Width="170"
Height="20"
Fill="{Binding Path=Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel Grid.Row="2"
Margin="0 10 0 0"
Orientation="Horizontal">
<ComboBox Name="colorComboBox"
Width="90"
Height="25"
ItemsSource="{Binding Source={StaticResource ColorsPropertyObjectDataProviderKey}}">
<ComboBox.ItemTemplate>
<DataTemplate>
<Rectangle
Width="70"
Height="20"
Fill="{Binding Path=Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Name="addButton"
Margin="10 0 0 0"
Width="50"
Content="추가" />
<Button Name="deleteButton"
Margin="10 0 0 0"
Width="40"
Content="삭제" />
</StackPanel>
<Label Grid.Row="3"
Margin="0 10 0 0"
Content="그라디언트 크기" />
<Slider Grid.Row="4"
Margin="0 10 0 0"
Minimum="10"
Maximum="600"
Value="{Binding GradientSize, ElementName=customBrush}" />
<Label Grid.Row="5"
Margin="0 10 0 0"
Content="그라디언트 디테일" />
<Slider Grid.Row="6"
Margin="0 10 0 0"
Minimum="0.1"
Maximum="100"
Value="{Binding GradientDetail, ElementName=customBrush}" />
</Grid>
</Grid>
</Grid>
</Window>
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] ItemsControl 클래스 : 리스트 컨트롤 사용하기 (드래그 기능 개선) (0) | 2020.12.19 |
---|---|
[C#/WPF] MarkupExtension 클래스 : 마크업 확장 사용하기 (0) | 2020.12.15 |
[C#/WPF] Image 클래스 : LayoutUpdated 이벤트를 사용해 이미지 픽셀 보정하기 (0) | 2020.12.13 |
[C#/WPF] FrameworkElement 클래스 : 장평을 설정하는 커스텀 텍스트 블럭 사용하기 (0) | 2020.12.13 |
[C#/WPF] Grid 클래스 : 환형 패널 사용하기 (0) | 2020.12.12 |
[C#/WPF] 파노라마 뷰 사용하기 (0) | 2020.12.06 |
[C#/WPF] TabControl 클래스 : FADE IN/OUT 탭 컨트롤 사용하기 (0) | 2020.12.06 |
[C#/WPF] FrameworkElement 엘리먼트 : FocusVisualStyle 속성을 사용해 포커스 사각형 제거하기 (0) | 2020.12.05 |
[C#/WPF] UIElement 클래스 : MouseMove 이벤트를 사용해 마우스 이동시 애니메이션 설정하기 (0) | 2020.12.05 |
[C#/WPF] EventTrigger 엘리먼트 : RoutedEvent 속성을 사용해 복권 긁는 효과 사용하기 (0) | 2020.12.05 |
댓글을 달아 주세요