PageRenderTime 25ms CodeModel.GetById 21ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/V4/Quickstarts/State-Based Navigation/State-Based Navigation/Views/SendMessageChildWindow.xaml

#
XAML | 55 lines | 48 code | 7 blank | 0 comment | 0 complexity | 1c407c3ba9735459ad25948ee9cf82a4 MD5 | raw file
 1<controls:ChildWindow
 2    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
 3    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
 4    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
 5    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
 6    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
 7    xmlns:System="clr-namespace:System;assembly=mscorlib" 
 8    x:Name="childWindow" 
 9    x:Class="StateBasedNavigation.Views.SendMessageChildWindow"
10    Width="400" Height="300" AutomationProperties.AutomationId="SendMessageChildWindow">
11    <i:Interaction.Triggers>
12        <ei:PropertyChangedTrigger Binding="{Binding Result}">
13            <ei:ChangePropertyAction TargetObject="{Binding ElementName=childWindow}" PropertyName="DialogResult" Value="{Binding Result}"/>
14        </ei:PropertyChangedTrigger>
15    </i:Interaction.Triggers>
16
17    <controls:ChildWindow.Title>
18        <TextBlock><Run Text="Send message to "/><Run Text="{Binding Contact.Name}"/></TextBlock>
19    </controls:ChildWindow.Title>
20
21    <Grid x:Name="LayoutRoot" Margin="2">
22
23        <ContentControl 
24            x:Name="UserInput"
25            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
26
27            <Grid>
28                <Grid.RowDefinitions>
29                    <RowDefinition />
30                    <RowDefinition Height="Auto" />
31                </Grid.RowDefinitions>
32
33                <TextBox 
34                    Text="{Binding Message, Mode=TwoWay}"
35                    HorizontalAlignment="Stretch" Margin="12,12,12,12" VerticalAlignment="Stretch" AutomationProperties.AutomationId="TextBoxMessage"/>
36
37                <Button x:Name="CancelButton" Content="Cancel" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" >
38                    <i:Interaction.Triggers>
39                        <i:EventTrigger EventName="Click">
40                            <ei:ChangePropertyAction TargetObject="{Binding}" PropertyName="Result" Value="False"/>
41                        </i:EventTrigger>
42                    </i:Interaction.Triggers>
43                </Button>
44                <Button x:Name="OKButton" Content="OK" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" >
45                    <i:Interaction.Triggers>
46                        <i:EventTrigger EventName="Click">
47                            <ei:ChangePropertyAction TargetObject="{Binding}" PropertyName="Result" Value="True"/>
48                        </i:EventTrigger>
49                    </i:Interaction.Triggers>
50                </Button>
51            </Grid>
52        </ContentControl>
53
54    </Grid>
55</controls:ChildWindow>