SagiK-Repository / POC_.Net_DevExpress

✔ [POC] .Net DevExpress를 분석합니다.
0 stars 0 forks source link

MVVM MainWindow-UserControl #16

Closed SAgiKPJH closed 7 months ago

SAgiKPJH commented 7 months ago

image image

SAgiKPJH commented 7 months ago

1. 재사용성

2. 모듈화

3. 데이터 바인딩

4. 사용자 인터페이스 관리

SAgiKPJH commented 7 months ago

그럼 MainWindow는 어디까지 건드려야 하나?

데이터 컨텍스트 설정


UserControl 로드


이벤트 핸들러


Window Manager, Window Factory

SAgiKPJH commented 7 months ago

MainWindow 활용 예시

1. UserControl 선택

    <Window.Resources>
        <DataTemplate DataType="{x:Type home:HomeViewModel}">
            <home:HomeView />
        </DataTemplate>

        <DataTemplate DataType="{x:Type other:OtherViewModel}">
            <other:OtherView />
        </DataTemplate>
    </Window.Resources>

    <Grid x:Name="MainContent" Grid.Row="1">
        <ContentControl Content="{Binding CurrentViewModel}" />
    </Grid>


2. MainWindow의 이벤트 핸들러 활용

MainView mainView = new MainView(); mainView.Show(); mainView.Closing += (o, e) => CloseMethod();

SAgiKPJH commented 7 months ago

결론 : 개발자가 어떻게 활용하느냐에 따라 다양하게 활용할 수 있다.