source: trunk/CrypPlugins/FrequencyTest/FrequencyTestPresentation.xaml @ 706

Last change on this file since 706 was 706, checked in by Arno Wacker, 12 years ago

Cosmetic changes to frequency test Presentation

  • Replaced the StackPanel with Grid to gain more control over placing elements
  • Added ChartHeight-settings, in case Autozoom is not used
  • Headline is now dynamically adapted depending on gram-length used.
  • In autozoom mode the chart now also adapts if the number of character changes during play (see e.g. the enigma-analyzer samples)
  • Added a slider to the settings for scaling - currently duplicates the slider in the presentation; maybe the in-presentations slider can be removed later (open: when moving the in-presentation-slider, the settings-slider does not move yet - not implemented)
  • Resize bug still open, no solution found yet, see #97
  • Updated the sample to avoid loading-warnings
File size: 3.8 KB
Line 
1<UserControl x:Class="Cryptool.FrequencyTest.FrequencyTestPresentation"
2    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4    xmlns:local="clr-namespace:Cryptool.FrequencyTest"       
5    Background="Transparent"
6    SnapsToDevicePixels="True"
7    HorizontalAlignment="Center"
8             Height="Auto"
9             Width="Auto"
10            x:Name="usercontrol" >
11   
12        <UserControl.Resources>
13
14        <local:DataSource x:Key="source"/>
15
16
17        <DataTemplate x:Key="template" >
18
19            <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" >
20                <Rectangle Width="3"/>
21                <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
22                   
23                    <TextBlock HorizontalAlignment="Center" Text="{Binding Path=Percent}">
24                    </TextBlock>
25
26                    <Rectangle Height="3"/>
27
28                    <Rectangle Height="{Binding Path=Amount}" Width="20" StrokeThickness="1" Stroke="Beige" RadiusX="5" RadiusY="5" ToolTip="{Binding Path=Caption}" >
29                        <Rectangle.BitmapEffect>
30                            <DropShadowBitmapEffect />
31                        </Rectangle.BitmapEffect>
32
33                        <Rectangle.Fill>
34                            <RadialGradientBrush >
35                                <GradientStop Color="Turquoise" Offset="0" />
36                                <GradientStop Color="DarkBlue" Offset="1" />
37                            </RadialGradientBrush>
38                        </Rectangle.Fill>
39
40                    </Rectangle>
41
42                    <Rectangle Height="5" />
43
44                    <TextBlock HorizontalAlignment="Center" Text="{Binding Path=Caption}"/>
45       
46                </StackPanel>               
47            </StackPanel>
48           
49
50        </DataTemplate>
51
52
53        <ItemsPanelTemplate x:Key="panelTemplate">
54            <StackPanel Orientation="Horizontal"/>
55        </ItemsPanelTemplate>
56
57    </UserControl.Resources>
58   
59   
60   
61   
62   
63    <Grid VerticalAlignment="Stretch">
64        <Grid.RowDefinitions>
65            <RowDefinition />
66            <RowDefinition Height="Auto" />
67        </Grid.RowDefinitions>
68       
69        <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto"  ScrollViewer.HorizontalScrollBarVisibility="Auto">
70            <Grid x:Name="chart" Grid.Row="0" VerticalAlignment="Stretch" >
71                <Grid.RowDefinitions>
72                    <RowDefinition Height="Auto" />
73                    <RowDefinition Height="1*" />
74                </Grid.RowDefinitions>
75               
76                <Grid.LayoutTransform>
77                    <ScaleTransform   ScaleX="{Binding ElementName=sli,Path=Value}" ScaleY="{Binding ElementName=sli, Path=Value}"/>
78                </Grid.LayoutTransform>
79             
80               <TextBlock x:Name="chartHeadline" TextAlignment="Center" Grid.Row="0" FontSize="20" Foreground="DarkBlue"  FontFamily="Academy" OpacityMask="Turquoise" Text="No data available yet!" ></TextBlock>
81
82               <ItemsControl Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"           
83                 ItemsSource="{Binding Source={StaticResource source},Path=ValueCollection}"
84                 ItemTemplate="{StaticResource template}" ItemsPanel="{StaticResource panelTemplate}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
85               </ItemsControl>
86
87            </Grid>
88        </ScrollViewer>
89       
90        <Slider x:Name="sli" Grid.Row="1" Width="100" HorizontalAlignment="Center" Minimum="0.05" VerticalAlignment="Bottom" Maximum="2" Value="1"/>
91       
92    </Grid>
93   
94   
95</UserControl>
96   
Note: See TracBrowser for help on using the repository browser.