[C#/WPF] FrameworkElement 클래스 : SetResourceReference 메소드를 사용해 동적 리소스(Dynamic Resource) 설정하기
C#/WPF 2021. 2. 6. 20:37728x90
반응형
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"
Width="800"
Height="600"
Title="FrameworkElement 클래스 : SetResourceReference 메소드를 사용해 동적 리소스(Dynamic Resource) 설정하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Window.Resources>
<Geometry x:Key="GeometryKey">
M 0 0 L 11.2 0 M 0 6.4 L 5.6 0 L 11.2 6.4 Z
</Geometry>
</Window.Resources>
<Grid>
<Border
Width="20"
Height="20"
BorderThickness="2"
BorderBrush="Blue">
<Path Name="path"
HorizontalAlignment="Center"
VerticalAlignment="Center"
StrokeThickness="1"
Stroke="Black"
Fill="Transparent" />
</Border>
</Grid>
</Window>
728x90
▶ MainWindow.xaml.cs
using System.Windows;
using System.Windows.Shapes;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
this.path.SetResourceReference(Path.DataProperty, "GeometryKey");
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] Timeline 엘리먼트 : DesiredFrameRate 첨부 속성을 사용해 애니메이션 프레임 속도 설정하기 (0) | 2021.02.07 |
---|---|
[C#/WPF] Timeline 클래스 : DesiredFrameRateProperty 의존 속성을 사용해 애니메이션 프레임 속도 설정하기 (0) | 2021.02.07 |
[C#/WPF] 모니터 정보 구하기 (0) | 2021.02.07 |
[C#/WPF] 다국어 사용하기 (0) | 2021.02.06 |
[C#/WPF] ResourceDictionary 엘리먼트 : Source 속성을 사용해 특정 윈도우즈 테마 설정하기 (0) | 2021.02.06 |
[C#/WPF] FrameworkElement 클래스 : SetResourceReference 메소드를 사용해 동적 리소스(Dynamic Resource) 설정하기 (0) | 2021.02.06 |
[C#/WPF] ResourceDictionary 클래스 : 리소스에서 리소스 딕셔너리 구하기 (0) | 2021.02.06 |
[C#/WPF] Application 클래스 : GetResourceStream 정적 메소드를 사용해 리소스 스트림 구하기 (0) | 2021.02.06 |
[C#/WPF] TransformedBitmap 클래스 : 이미지 수평/수직 뒤집기 (0) | 2021.02.06 |
[C#/WPF] BitmapSource 클래스 : 이미지 자동으로 잘라내기 (0) | 2021.02.06 |
[C#/WPF] BitmapImage 클래스 : 썸네일 이미지 구하기 (0) | 2021.02.06 |
댓글을 달아 주세요