WPF

Doosan published on
2 min, 214 words

Categories: post

namespace

wpf 예제를 보면 x:Type 이런게 보이는데 도대체 x는 뭔가?
파일 제일 위쪽을 보면 이런게 보일텐데

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  

C# 코드에서 파일 첫줄에 네임스페이스 적는 것이랑 똑같다


ContentControl

ContentControl은 기본이 되는 클래스
app.xaml.cs 이 프로그램의 시작점인데 MainWindow를 돌린다.
MainWindow는 Window를 상속하고 Window는 ContentControl를 상속한다.
사실 우리는 ContentControl을 알게모르게 사용중인 것이다.

<ContentControl content={Binding CurrentViewModel}/>
<ContentControl content={StaticResource person}/>

UIViewModel을 보여주는 뷰를 views:UIView 로 세팅 DataTemplate 안에 넣는 것을 보여준다

<ContentControl content={Binding CurrentViewModel}>
    <ContentControl.Resources>
        <DataTemplate DataType="{x:Type viewModels:UIViewModel}">
        <views:UIView>
        </views:UIView>
        </DataTemplate>
    </ContentControl.Resources>
</ContentControl>

Binding="{Binding Name}" Binding="{Binding ElementName=Name}"


Display data

wpf를 공부하다 보면 데이터를 테이블이나 리스트 같은 걸로 표현해야 할때가 있는데 예제들에서 자주 보이는 컨트롤러들은 다음과 같다

DataGrid vs GridView vs ItemsControl vs ListBox vs ListView
상속의 순서는
ItemControl->ListBox->ListView
그리고 GridView view mode는 ListView Control의 view mode이다.
더 자세한 내용은 여기서 보자


{Binding PropertyName} and

https://stackoverflow.com/questions/4306657/difference-between-binding-propertyname-and-binding-path-propertyname


SelectedValue vs SelectedItem


Textbox getting userinput