|
<UserControl
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:ViewModelCommunication"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
mc:Ignorable="d"
x:Class="ViewModelCommunication.MainPage" Width="334" Height="307">
<Grid x:Name="LayoutRoot">
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="#FFCA5656" Offset="1"/>
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="0.137*"/>
<RowDefinition Height="0.863*"/>
</Grid.RowDefinitions>
<Grid.DataContext>
<local:MainPageModel/>
</Grid.DataContext>
<local:ChildVM x:Name="childVM" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="13,0,0,0" DataContext="{Binding objChildVMModel, Mode=OneWay}"/>
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment" Margin="13,10,0,0">
<TextBox x:Name="textBox" TextWrapping="Wrap" Height="22" Width="150" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,5,0"/>
<Button x:Name="Add" Content="Add" Width="50">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction CommandParameter="{Binding Text, ElementName=textBox}" Command="{Binding objChildVMModel.AddNewNameCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button x:Name="Delete" Content="Delete" Width="50" Margin="5,0,0,0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding objChildVMModel.DeleteNameCommand}" CommandParameter="{Binding Text, ElementName=textBox}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<TextBlock Text="{Binding objChildVMModel.NumberOfNames, Mode=OneWay}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="6,0,0,0" Foreground="#FFD00808"/>
</StackPanel>
</Grid>
</UserControl>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.