대부분의 프로그래머들이 간단한 1차원적인 프로그램만 만들고 있기 때문이다.
WPF는 PANEL 이라는게 추가 되어서 하나 이상의 CANVAS 를 겹쳐서 표시할 수 있다.
당연히 이런 문제로 이벤트로 연결해서 보낸다.
DependencyProperty 같은 어려운(이상한) 개념 때문일 것이다.
C# 으로 하면 될 것을 굳이 WPF 로 만들려면.,...
전체 코드의 양은 줄어들지 몰라도
추상적인 프로그래밍 방법을 이해 못하면 생각보다 많은 노력이 필요할 수도 있다.
쉽게 말하면
WPF 컴파일러가 컴파일해서 실행하는
추상된 결과를 기대하며 프로그래밍을 해야 한다는 것이다.
?
이게 프로그래머라고?
GUI 적인 프로그래머는 대우가 정말 안 좋다.
일은 엄청나지만 말이다.
출처는 아래와 같다. 2010년도에서 이글을 본적이 있다.
5년만에 WPF 를 다시 본다.
https://dotnetmvp.tistory.com/36?category=125280
14. [WPF 기초 강좌] WPF의 새로운 중요 개념 4
안녕하세요. WPF 기초강좌를 진행하는 김창민입니다. 어느덧 벌써 2월이 다 지나가고 3월이 시작되네요… 2월 한 달이 어떻게 지나..
dotnetmvp.tistory.com
아래 예제를 보면 알 수 있다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Dependencyproperty_Test
{
///
/// Window1.xaml에 대한 상호 작용 논리
///
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
public String UserText
{
get { return (String)GetValue(UserProperty); }
set { SetValue(UserProperty, value); }
}
public static readonly DependencyProperty UserProperty = DependencyProperty.Register(
"TextChange",
typeof(String),
typeof(Window1),
new FrameworkPropertyMetadata(new PropertyChangedCallback(OnTextChangePropertyChanged)));
private static void OnTextChangePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Window1 userNamecontrol = d as Window1;
string newText = (string)e.NewValue;
string oldText = (string)e.OldValue;
userNamecontrol.txtNewText.Text = newText;
userNamecontrol.txtOldText.Text = oldText;
}
private void btnChange_Click(object sender, RoutedEventArgs e)
{
UserText = textBox1.Text;
}
}
}