|
|
|
@ -0,0 +1,77 @@ |
|
|
|
|
<Window x:Class="MVVMwithWPF.Views.BindingSampleWithoutViewModelWindow" |
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
|
|
|
xmlns:attachedProperties="clr-namespace:MVVMwithWPF.AttachedProperties" |
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
|
|
|
xmlns:local="clr-namespace:MVVMwithWPF.Views" |
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
|
|
|
xmlns:models="clr-namespace:MVVMwithWPF.Models" |
|
|
|
|
Title="BindingSampleWithoutViewModelWindow" |
|
|
|
|
Width="800" |
|
|
|
|
Height="450" |
|
|
|
|
mc:Ignorable="d"> |
|
|
|
|
<Window.Resources> |
|
|
|
|
<models:Person x:Key="CreateUser" |
|
|
|
|
Name="person0001" |
|
|
|
|
Id="1" Sex="True" /> |
|
|
|
|
<Style x:Key="SampleContentStyle" TargetType="{x:Type ContentControl}"> |
|
|
|
|
<Setter Property="Template"> |
|
|
|
|
<Setter.Value> |
|
|
|
|
<ControlTemplate TargetType="{x:Type ContentControl}"> |
|
|
|
|
<Grid> |
|
|
|
|
<Grid.RowDefinitions> |
|
|
|
|
<RowDefinition Height="Auto" /> |
|
|
|
|
<RowDefinition /> |
|
|
|
|
</Grid.RowDefinitions> |
|
|
|
|
<TextBlock FontSize="20" Foreground="DarkSlateBlue" |
|
|
|
|
Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(attachedProperties:MessageExt.Message)}" /> |
|
|
|
|
<ContentPresenter Grid.Row="1" /> |
|
|
|
|
</Grid> |
|
|
|
|
</ControlTemplate> |
|
|
|
|
</Setter.Value> |
|
|
|
|
</Setter> |
|
|
|
|
</Style> |
|
|
|
|
</Window.Resources> |
|
|
|
|
<Grid> |
|
|
|
|
<Grid.ColumnDefinitions> |
|
|
|
|
<ColumnDefinition Width="*" /> |
|
|
|
|
<ColumnDefinition Width="*" /> |
|
|
|
|
</Grid.ColumnDefinitions> |
|
|
|
|
<Grid.RowDefinitions> |
|
|
|
|
<RowDefinition /> |
|
|
|
|
<RowDefinition /> |
|
|
|
|
</Grid.RowDefinitions> |
|
|
|
|
<StackPanel Margin="10"> |
|
|
|
|
<TextBlock Text="Edit Current User" /> |
|
|
|
|
<TextBlock Text="{Binding Source={StaticResource CreateUser}, Path=Id}" /> |
|
|
|
|
<TextBox Text="{Binding Source={StaticResource CreateUser}, Path=Name, UpdateSourceTrigger=PropertyChanged}" /> |
|
|
|
|
<CheckBox IsChecked="{Binding Source={StaticResource CreateUser}, Path=Sex, Mode=TwoWay}" /> |
|
|
|
|
<Grid> |
|
|
|
|
<Grid.ColumnDefinitions> |
|
|
|
|
<ColumnDefinition /> |
|
|
|
|
<ColumnDefinition /> |
|
|
|
|
<ColumnDefinition /> |
|
|
|
|
</Grid.ColumnDefinitions> |
|
|
|
|
<TextBlock Text="{Binding Source={StaticResource CreateUser}, Path=Id}" /> |
|
|
|
|
<TextBlock Grid.Column="1" Text="{Binding Source={StaticResource CreateUser}, Path=Name}" /> |
|
|
|
|
<TextBlock Grid.Column="2" Text="{Binding Source={StaticResource CreateUser}, Path=Sex}" /> |
|
|
|
|
</Grid> |
|
|
|
|
</StackPanel> |
|
|
|
|
<StackPanel Grid.Column="1" Margin="10"> |
|
|
|
|
<TextBlock Text="Window Title" /> |
|
|
|
|
<TextBlock Text="{Binding Source={x:Static Application.Current}, Path=MainWindow.Title}" /> |
|
|
|
|
<TextBlock Text="Shutdown Mode" /> |
|
|
|
|
<TextBlock Text="{Binding Source={x:Static Application.Current}, Path=ShutdownMode}" /> |
|
|
|
|
</StackPanel> |
|
|
|
|
<StackPanel Grid.Row="1"> |
|
|
|
|
<TextBox x:Name="tbxHeader" Text="ContentControl의 헤더를 입력하세요." /> |
|
|
|
|
<ContentControl attachedProperties:MessageExt.Message="{Binding ElementName=tbxHeader, Path=Text}" Style="{StaticResource SampleContentStyle}"> |
|
|
|
|
<ContentControl.Content> |
|
|
|
|
<StackPanel> |
|
|
|
|
<TextBlock Text="여기는 컨텐츠 컨트롤의 컨텐츠 영역입니다."/> |
|
|
|
|
</StackPanel> |
|
|
|
|
</ContentControl.Content> |
|
|
|
|
</ContentControl> |
|
|
|
|
</StackPanel> |
|
|
|
|
</Grid> |
|
|
|
|
</Window> |