PageRenderTime 29ms CodeModel.GetById 13ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/V2/trunk/RI/Silverlight/StockTraderRI.Modules.News.Silverlight/Article/ArticleView.xaml

#
XAML | 276 lines | 274 code | 0 blank | 2 comment | 0 complexity | 7f4bfe97b437f47b73b21dba7e00eeaf MD5 | raw file
  1<UserControl x:Class="StockTraderRI.Modules.News.Article.ArticleView"
  2    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" 
  5    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  6    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  7    mc:Ignorable="d"
  8     HorizontalAlignment="Left">
  9    <UserControl.Resources>
 10        <!-- By convention every view inside the ResearchControl (ResearchRegion) has to declare 
 11             a DataTemplate with the "HeaderIcon" key which defines the icon on the Header -->
 12        <DataTemplate x:Key="HeaderIcon">
 13            <Grid Margin="15,5,0,0" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="14.5" Height="16.375">
 14                <Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFFFFFFF" StrokeThickness="2" Data="M409.875,447.625 L409.875,433.25 418.625,433.25 422.375,437 422.375,447.625 z"/>
 15                <Path Margin="2.75,0,2.625,4.25" VerticalAlignment="Bottom" Height="2" Fill="{x:Null}" Stretch="Fill" Stroke="#FFFFFFFF" StrokeThickness="2" Data="M328.625,443.375 L335.75,443.375"/>
 16                <Path Margin="2.75,6.375,2.625,8" Fill="{x:Null}" Stretch="Fill" Stroke="#FFFFFFFF" StrokeThickness="2" Data="M328.625,443.375 L335.75,443.375"/>
 17            </Grid>
 18        </DataTemplate>
 19        <Style x:Key="ArticleItemStyle" TargetType="ListBoxItem">
 20            <Setter Property="Template">
 21                <Setter.Value>
 22                    <ControlTemplate TargetType="ListBoxItem">
 23                        <ContentPresenter/>
 24                    </ControlTemplate>
 25                </Setter.Value>
 26            </Setter>
 27        </Style>
 28        <DataTemplate x:Key="ArticleDataTemplate">
 29            <StackPanel Margin="0,0,0,10" Width="230" Cursor="Hand" HorizontalAlignment="Left">
 30                <TextBlock Text="{Binding Path=PublishedDate}" Foreground="#FF808080" FontFamily="Trebuchet MS" FontSize="12"/>
 31                <TextBlock Text="{Binding Path=Title}" Foreground="#FF808080" FontFamily="Trebuchet MS" FontSize="14" TextWrapping="Wrap" />
 32            </StackPanel>
 33        </DataTemplate>
 34        <ControlTemplate x:Key="BackButtonTemplate" TargetType="Button">
 35            <StackPanel HorizontalAlignment="Center"  VerticalAlignment="Center" Background="#00000000" Width="22" Height="22">
 36                <vsm:VisualStateManager.VisualStateGroups>
 37                    <vsm:VisualStateGroup x:Name="FocusStates">
 38                        <vsm:VisualState x:Name="Unfocused"/>
 39                        <vsm:VisualState x:Name="Focused"/>
 40                    </vsm:VisualStateGroup>
 41                    <vsm:VisualStateGroup x:Name="CommonStates">
 42                        <vsm:VisualStateGroup.Transitions>
 43                            <vsm:VisualTransition GeneratedDuration="00:00:00.1000000"/>
 44                        </vsm:VisualStateGroup.Transitions>
 45                        <vsm:VisualState x:Name="MouseOver">
 46                            <Storyboard>
 47                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.Opacity)">
 48                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
 49                                </DoubleAnimationUsingKeyFrames>
 50                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(UIElement.Opacity)">
 51                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
 52                                </DoubleAnimationUsingKeyFrames>
 53                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle2" Storyboard.TargetProperty="(UIElement.Opacity)">
 54                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
 55                                </DoubleAnimationUsingKeyFrames>
 56                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
 57                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/>
 58                                </ColorAnimationUsingKeyFrames>
 59                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
 60                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/>
 61                                </ColorAnimationUsingKeyFrames>
 62                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
 63                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/>
 64                                </ColorAnimationUsingKeyFrames>
 65                            </Storyboard>
 66                        </vsm:VisualState>
 67                        <vsm:VisualState x:Name="Normal"/>
 68                        <vsm:VisualState x:Name="Pressed">
 69                            <Storyboard>
 70                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
 71                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
 72                                </ColorAnimationUsingKeyFrames>
 73                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
 74                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
 75                                </ColorAnimationUsingKeyFrames>
 76                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
 77                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
 78                                </ColorAnimationUsingKeyFrames>
 79                            </Storyboard>
 80                        </vsm:VisualState>
 81                        <vsm:VisualState x:Name="Disabled"/>
 82                    </vsm:VisualStateGroup>
 83                </vsm:VisualStateManager.VisualStateGroups>
 84                <Rectangle x:Name="rectangle" Height="3" Margin="0,2,0,2" Width="22" Fill="#FFA6A6A6" StrokeThickness="0" RadiusX="2" RadiusY="2"/>
 85                <Rectangle x:Name="rectangle1" Height="3" Width="22" Fill="#FFA6A6A6" StrokeThickness="0" RadiusX="2" RadiusY="2" Margin="0,2,0,2"/>
 86                <Rectangle x:Name="rectangle2" Height="3" Width="22" Fill="#FFA6A6A6" StrokeThickness="0" RadiusX="2" RadiusY="2" Margin="0,2,0,2"/>
 87            </StackPanel>
 88        </ControlTemplate>
 89        <ControlTemplate x:Key="OpenButtonTemplate" TargetType="Button">
 90            <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Background="#00000000" Width="22" Height="22">
 91                <vsm:VisualStateManager.VisualStateGroups>
 92                    <vsm:VisualStateGroup x:Name="FocusStates">
 93                        <vsm:VisualState x:Name="Unfocused"/>
 94                        <vsm:VisualState x:Name="Focused"/>
 95                    </vsm:VisualStateGroup>
 96                    <vsm:VisualStateGroup x:Name="CommonStates">
 97                        <vsm:VisualStateGroup.Transitions>
 98                            <vsm:VisualTransition GeneratedDuration="00:00:00.1000000"/>
 99                        </vsm:VisualStateGroup.Transitions>
100                        <vsm:VisualState x:Name="MouseOver">
101                            <Storyboard>
102                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
103                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/>
104                                </ColorAnimationUsingKeyFrames>
105                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="path1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
106                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/>
107                                </ColorAnimationUsingKeyFrames>
108                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="path2" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
109                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/>
110                                </ColorAnimationUsingKeyFrames>
111                            </Storyboard>
112                        </vsm:VisualState>
113                        <vsm:VisualState x:Name="Normal"/>
114                        <vsm:VisualState x:Name="Pressed">
115                            <Storyboard>
116                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
117                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
118                                </ColorAnimationUsingKeyFrames>
119                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="path1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
120                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
121                                </ColorAnimationUsingKeyFrames>
122                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="path2" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
123                                    <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
124                                </ColorAnimationUsingKeyFrames>
125                            </Storyboard>
126                        </vsm:VisualState>
127                        <vsm:VisualState x:Name="Disabled"/>
128                    </vsm:VisualStateGroup>
129                </vsm:VisualStateManager.VisualStateGroups>
130                <Path x:Name="path" Data="M0,1 L11,1 L11,3 L2,3 L2,18 L17,18 L17,9 L19,9 L19,20 L0,20 z" Fill="#FFA6A6A6" Stretch="Fill" StrokeThickness="0" Margin="2,3,3,2"/>
131                <Path x:Name="path2" Height="14" Width="14" Data="M8,12 L20,0" Stretch="Fill" Stroke="#FFA6A6A6" StrokeThickness="2" Margin="0,-6,-6,0"/>
132                <Path x:Name="path1" Height="7" Width="7" Data="M0,0 L7,0 L7,7 z" Fill="#FFA6A6A6" Stretch="Fill" StrokeThickness="2" Margin="0,-13,-13,0"/>
133            </Grid>
134        </ControlTemplate>
135    </UserControl.Resources>
136    <Border Padding="10,10,10,10">
137        <vsm:VisualStateManager.VisualStateGroups>
138            <vsm:VisualStateGroup x:Name="Common">
139                <vsm:VisualStateGroup.Transitions>
140                    <vsm:VisualTransition GeneratedDuration="00:00:00" To="Details"/>
141                    <vsm:VisualTransition GeneratedDuration="00:00:00" To="List"/>
142                </vsm:VisualStateGroup.Transitions>
143                <vsm:VisualState x:Name="List">
144                    <Storyboard>
145                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ListGrid" Storyboard.TargetProperty="(UIElement.Visibility)">
146                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
147                                <DiscreteObjectKeyFrame.Value>
148                                    <Visibility>Collapsed</Visibility>
149                                </DiscreteObjectKeyFrame.Value>
150                            </DiscreteObjectKeyFrame>
151                            <DiscreteObjectKeyFrame KeyTime="00:00:00.3000000">
152                                <DiscreteObjectKeyFrame.Value>
153                                    <Visibility>Visible</Visibility>
154                                </DiscreteObjectKeyFrame.Value>
155                            </DiscreteObjectKeyFrame>
156                            <DiscreteObjectKeyFrame KeyTime="00:00:00.6000000">
157                                <DiscreteObjectKeyFrame.Value>
158                                    <Visibility>Visible</Visibility>
159                                </DiscreteObjectKeyFrame.Value>
160                            </DiscreteObjectKeyFrame>
161                        </ObjectAnimationUsingKeyFrames>
162                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ListGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
163                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
164                            <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
165                            <SplineDoubleKeyFrame KeySpline="0.5,0,0.5,1" KeyTime="00:00:00.6000000" Value="1"/>
166                        </DoubleAnimationUsingKeyFrames>
167                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="DetailsGrid" Storyboard.TargetProperty="(UIElement.Visibility)">
168                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
169                                <DiscreteObjectKeyFrame.Value>
170                                    <Visibility>Visible</Visibility>
171                                </DiscreteObjectKeyFrame.Value>
172                            </DiscreteObjectKeyFrame>
173                            <DiscreteObjectKeyFrame KeyTime="00:00:00.3000000">
174                                <DiscreteObjectKeyFrame.Value>
175                                    <Visibility>Collapsed</Visibility>
176                                </DiscreteObjectKeyFrame.Value>
177                            </DiscreteObjectKeyFrame>
178                        </ObjectAnimationUsingKeyFrames>
179                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="DetailsGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
180                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
181                            <SplineDoubleKeyFrame KeySpline="0.5,0,0.5,1" KeyTime="00:00:00.3000000" Value="0"/>
182                        </DoubleAnimationUsingKeyFrames>
183                    </Storyboard>
184                </vsm:VisualState>
185                <vsm:VisualState x:Name="Details">
186                    <Storyboard>
187                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ListGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
188                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
189                            <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0" KeySpline="0.5,0,0.5,1"/>
190                        </DoubleAnimationUsingKeyFrames>
191                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ListGrid" Storyboard.TargetProperty="(UIElement.Visibility)">
192                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
193                                <DiscreteObjectKeyFrame.Value>
194                                    <Visibility>Visible</Visibility>
195                                </DiscreteObjectKeyFrame.Value>
196                            </DiscreteObjectKeyFrame>
197                            <DiscreteObjectKeyFrame KeyTime="00:00:00.3000000">
198                                <DiscreteObjectKeyFrame.Value>
199                                    <Visibility>Collapsed</Visibility>
200                                </DiscreteObjectKeyFrame.Value>
201                            </DiscreteObjectKeyFrame>
202                        </ObjectAnimationUsingKeyFrames>
203                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="DetailsGrid" Storyboard.TargetProperty="(UIElement.Visibility)">
204                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
205                                <DiscreteObjectKeyFrame.Value>
206                                    <Visibility>Collapsed</Visibility>
207                                </DiscreteObjectKeyFrame.Value>
208                            </DiscreteObjectKeyFrame>
209                            <DiscreteObjectKeyFrame KeyTime="00:00:00.3000000">
210                                <DiscreteObjectKeyFrame.Value>
211                                    <Visibility>Visible</Visibility>
212                                </DiscreteObjectKeyFrame.Value>
213                            </DiscreteObjectKeyFrame>
214                            <DiscreteObjectKeyFrame KeyTime="00:00:00.6000000">
215                                <DiscreteObjectKeyFrame.Value>
216                                    <Visibility>Visible</Visibility>
217                                </DiscreteObjectKeyFrame.Value>
218                            </DiscreteObjectKeyFrame>
219                        </ObjectAnimationUsingKeyFrames>
220                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="DetailsGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
221                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
222                            <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
223                            <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="1" KeySpline="0.5,0,0.5,1"/>
224                        </DoubleAnimationUsingKeyFrames>
225                    </Storyboard>
226                </vsm:VisualState>
227            </vsm:VisualStateGroup>
228        </vsm:VisualStateManager.VisualStateGroups>
229        <StackPanel>
230            <Grid x:Name="ListGrid" RenderTransformOrigin="0.5,0.5" Width="240">
231                <Grid.RenderTransform>
232                    <TransformGroup>
233                        <ScaleTransform/>
234                        <SkewTransform/>
235                        <RotateTransform/>
236                        <TranslateTransform/>
237                    </TransformGroup>
238                </Grid.RenderTransform>
239                <Grid.RowDefinitions>
240                    <RowDefinition Height="Auto" />
241                    <RowDefinition Height="*" />
242                </Grid.RowDefinitions>
243                <TextBlock Grid.Row="0" Text="NEWS ARTICLES" Style="{StaticResource TextBlockSectionTitle}" AutomationProperties.AutomationId="NewsArticleText" />
244                    <ListBox Grid.Row="1" BorderThickness="0"  ItemsSource="{Binding Path=Articles}"
245    					ItemTemplate="{StaticResource ArticleDataTemplate}"
246    					ItemContainerStyle="{StaticResource ArticleItemStyle}" ScrollViewer.VerticalScrollBarVisibility="Hidden"
247                        x:Name="NewsList"
248    					SelectedItem="{Binding Mode=TwoWay, Path=SelectedArticle}" Margin="0,0,0,0" Background="{x:Null}" BorderBrush="{x:Null}" SelectionChanged="ListBox_SelectionChanged"/>
249            </Grid>
250            <Grid x:Name="DetailsGrid" Visibility="Collapsed" RenderTransformOrigin="0.5,0.5" Width="240" DataContext="{Binding Path=SelectedArticle}" >
251                <Grid.RenderTransform>
252                    <TransformGroup>
253                        <ScaleTransform/>
254                        <SkewTransform/>
255                        <RotateTransform/>
256                        <TranslateTransform/>
257                    </TransformGroup>
258                </Grid.RenderTransform>
259                <Grid.RowDefinitions>
260                    <RowDefinition Height="Auto" />
261                    <RowDefinition Height="*" />
262                </Grid.RowDefinitions>
263                <Grid.ColumnDefinitions>
264                    <ColumnDefinition Width="*" />
265                    <ColumnDefinition Width="Auto" />
266                </Grid.ColumnDefinitions>
267                <TextBlock Grid.Row="0" Text="{Binding Path=Title}" Style="{StaticResource TextBlockSectionTitle}" TextWrapping="Wrap" MaxWidth="170" HorizontalAlignment="Left" />
268                <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Path=Body}" Foreground="#FF808080" FontFamily="Trebuchet MS" FontSize="12" TextWrapping="Wrap" />
269                <StackPanel Height="22" Grid.Column="1" Grid.Row="0" d:LayoutOverrides="GridBox" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top">
270                    <Button Click="BackButton_Click" Template="{StaticResource BackButtonTemplate}" Cursor="Hand" Content="{StaticResource BackButtonTemplate}" HorizontalAlignment="Left" />
271                    <Button Click="OpenButton_Click" Template="{StaticResource OpenButtonTemplate}" Cursor="Hand" Content="{StaticResource OpenButtonTemplate}" HorizontalAlignment="Left" Margin="5,0,0,0" />
272                </StackPanel>
273            </Grid>
274        </StackPanel>
275    </Border>
276</UserControl>