StaticResource와 Binding 모두 WPF에서 사용되는 데이터 바인딩 방식
StaticResource는 정적인 데이터를 참조하는데 사용됨
처음에 한 번 리소스를 로드하고 나서는 그것을 캐싱하여 사용
변경사항을 적용하려면 앱을 재시작 해야 함
<Window.Resources>
<Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="Green"/>
</Style>
</Window.Resources>
<Button Style="{StaticResource ButtonStyle}" Content="StaticResource"/>
<Button Style="{StaticResource ButtonStyle}" Content="StaticResource"/>
Binding은 동적인 데이터를 참조하는데 사용됨
UI 요소와 데이터 소스를 바인딩하여 데이터 변경을 자동으로 반영
<TextBlock Text="{Binding Name}"/>
'Language > C#' 카테고리의 다른 글
[C#/WPF] Tabcontrol Header 숨기기 (0) | 2023.06.08 |
---|---|
[C#/WPF] 일괄 변경 반복문 (0) | 2023.05.10 |
[C#/WPF] null 병합 연산자 (null coalescing operator) (0) | 2023.04.21 |
[C#/WPF] 시리얼 통신 폰트 정렬 (0) | 2023.04.17 |
[C#/WPF] 제네릭 (0) | 2023.04.04 |