PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/V4/Quickstarts/View-Switching Navigation/Silverlight/View-Switching Navigation/ViewSwitchingNavigation.Email/Views/ComposeEmailView.xaml

#
XAML | 92 lines | 82 code | 10 blank | 0 comment | 1 complexity | be79ea9e6d9cbab714b51f7c6c587a3c MD5 | raw file
 1<UserControl 
 2    x:Class="ViewSwitchingNavigation.Email.Views.ComposeEmailView"
 3    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 4    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
 5    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 6    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 7    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 8    xmlns:i="http://schemas.microsoft.com/expression/2010/interactions"
 9    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactivity"
10    xmlns:sys="clr-namespace:System;assembly=mscorlib"
11    xmlns:prism="http://www.codeplex.com/prism" 
12    xmlns:GuidanceTools="clr-namespace:Microsoft.Practices.Prism.GuidanceTools;assembly=Microsoft.Practices.Prism.GuidanceTools" mc:Ignorable="d"
13    d:DesignHeight="300" d:DesignWidth="400" 
14    d:DataContext="{d:DesignData /SampleData/ComposeEmailViewModelSampleData.xaml}">
15
16    <UserControl.Resources>
17        <DataTemplate x:Name="ConfirmExitDialogTemplate">
18            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding}"/>
19        </DataTemplate>
20    </UserControl.Resources>
21
22    <Grid x:Name="LayoutRoot" Background="White">
23        <ei:Interaction.Behaviors>
24            <i:DataStateBehavior Binding="{Binding SendState}" Value="Sending" TrueState="Sending" FalseState="Normal"/>
25        </ei:Interaction.Behaviors>
26        <ei:Interaction.Triggers>
27            <prism:InteractionRequestTrigger SourceObject="{Binding ConfirmExitInteractionRequest}">
28                <prism:PopupChildWindowAction ContentTemplate="{StaticResource ConfirmExitDialogTemplate}"/>
29            </prism:InteractionRequestTrigger>
30        </ei:Interaction.Triggers>
31        <VisualStateManager.VisualStateGroups>
32            <VisualStateGroup x:Name="VisualStateGroup">
33                <VisualState x:Name="Normal"/>
34                <VisualState x:Name="Sending">
35                    <Storyboard>
36                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="MainControl">
37                            <DiscreteObjectKeyFrame KeyTime="0">
38                                <DiscreteObjectKeyFrame.Value>
39                                    <sys:Boolean>False</sys:Boolean>
40                                </DiscreteObjectKeyFrame.Value>
41                            </DiscreteObjectKeyFrame>
42                        </ObjectAnimationUsingKeyFrames>
43                    </Storyboard>
44                </VisualState>
45            </VisualStateGroup>
46        </VisualStateManager.VisualStateGroups>
47        <ContentControl x:Name="MainControl" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="5">
48            <Grid>
49                <Grid.RowDefinitions>
50                    <RowDefinition Height="Auto"/>
51                    <RowDefinition Height="Auto"/>
52                    <RowDefinition Height="*"/>
53                    <RowDefinition Height="Auto"/>
54                </Grid.RowDefinitions>
55
56                <Grid.ColumnDefinitions>
57                    <ColumnDefinition Width="Auto"/>
58                    <ColumnDefinition Width="*"/>
59                </Grid.ColumnDefinitions>
60
61                <sdk:Label Grid.Row="0" Grid.Column="0" Margin="0,0,5,0" VerticalAlignment="Bottom">To:</sdk:Label>
62                <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding EmailDocument.To}" AutomationProperties.AutomationId="ToTextBox"/>
63
64                <sdk:Label Grid.Row="1" Grid.Column="0" Margin="0,0,5,0" VerticalAlignment="Bottom">Subject:</sdk:Label>
65                <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding EmailDocument.Subject}" Margin="0,5,0,0" AutomationProperties.AutomationId="SubjectTextBox"/>
66
67                <TextBox Text="{Binding EmailDocument.Text}" AcceptsReturn="True" MinHeight="100"
68                         Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalScrollBarVisibility="Auto"
69                         Padding="0" Margin="0,5" AutomationProperties.AutomationId="EmailTextBox"/>
70
71                <StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
72                    <Button Command="{Binding SendEmailCommand}" Grid.Row="3" Grid.Column="1" Width="60" Margin="6,0">
73                        Send
74                    </Button>
75
76                    <Button Command="{Binding CancelEmailCommand}" Width="60">
77                        Cancel
78                    </Button>
79
80                    <GuidanceTools:InfoTipToggleButton VerticalAlignment="Center">
81                        <StackPanel MinWidth="100" MinHeight="24" MaxWidth="400">
82                            <TextBlock Margin="2" TextWrapping="Wrap">The Send button demonstrates navigating backwards in the regions journal, after sending the email.</TextBlock>
83                            <TextBlock Margin="2" TextWrapping="Wrap">The Cancel button demonstrates the ability to cancel a navigation request after asking the user if they're sure they want to discard their changes.</TextBlock>
84                            <TextBlock Margin="2" TextWrapping="Wrap">Both of these can be seen in the ComposeEmailViewModel's implementation.</TextBlock>
85                        </StackPanel>
86                    </GuidanceTools:InfoTipToggleButton>
87                </StackPanel>
88
89            </Grid>
90        </ContentControl>
91    </Grid>
92</UserControl>