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"
Width="800"
Height="600"
Title="LogicalTreeHelper 클래스 : FindLogicalNode 정적 메소드를 사용해 엘리먼트 찾기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Grid>
<TextBlock Name="textBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
</Window>
728x90
▶ MainWindow.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
Loaded += Window_Loaded;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 윈도우 로드시 처리하기 - Window_Loaded(sender, e)
/// <summary>
/// 윈도우 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void Window_Loaded(object sender, RoutedEventArgs e)
{
TextBlock textBlock = (TextBlock)LogicalTreeHelper.FindLogicalNode(this, "textBlock" );
textBlock.Text = DateTime.Now.ToLongDateString();
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] RoutedCommand 클래스 : 커스텀 라우팅 명령 사용하기 (0) | 2020.09.15 |
---|---|
[C#/WPF] Button 엘리먼트 : CommandTarget 속성 사용하기 (0) | 2020.09.15 |
[C#/WPF] KeyBinding 클래스 : 단축키 사용하기 (0) | 2020.09.15 |
[C#/WPF] Behavior<T> 클래스 : 숫자 입력 텍스트 박스 동작 사용하기 (0) | 2020.09.14 |
[C#/WPF] TextBox 클래스 : PreviewTextInput 이벤트를 사용해 3자리마다 콤마를 갖는 숫자 입력하기 (0) | 2020.09.14 |
[C#/WPF] CollectionViewSource 엘리먼트 : Source 속성 사용하기 (0) | 2020.09.14 |
[C#/WPF] BindingOperations 클래스 : ClearBinding/SetBinding 정적 메소드를 사용해 바인딩하기 (0) | 2020.09.14 |
[C#/WPF] Grid 클래스 : 자동 인덱스 설정 그리드 사용하기 (0) | 2020.09.13 |
[C#/WPF] Material 메뉴 사용하기 (0) | 2020.09.13 |
[C#/WPF] Animatable 클래스 : BeginAnimation 메소드를 사용해 공 움직이기 (0) | 2020.09.11 |
댓글을 달아 주세요