You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.3 KiB
28 lines
1.3 KiB
<Window x:Class="CommandPatternSample.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:local="clr-namespace:CommandPatternSample"
|
|
xmlns:vm="clr-namespace:CommandPatternSample.ViewModel"
|
|
mc:Ignorable="d"
|
|
Title="MainWindow" Height="300" Width="400">
|
|
<Window.DataContext>
|
|
<vm:EmpViewModel/>
|
|
</Window.DataContext>
|
|
|
|
<StackPanel Margin="10">
|
|
<TextBlock Text="Enter the employee name."/>
|
|
<TextBox x:Name="tbName"
|
|
Text="{Binding SelectedEmp.Name}"/>
|
|
<Button Content="Add"
|
|
Command="{Binding AddEmpCommand}"
|
|
CommandParameter="{Binding ElementName=tbName, Path=Text}"/>
|
|
<ListBox x:Name="lbEmps"
|
|
ItemsSource="{Binding Emps}"
|
|
SelectedItem="{Binding SelectedEmp}"
|
|
DisplayMemberPath="Name"/>
|
|
<Label Height="40" Width="150" HorizontalAlignment="Center"
|
|
Content="{Binding ElementName=lbEmps, Path=SelectedItem}"/>
|
|
</StackPanel>
|
|
</Window>
|
|
|