/Main/src/DynamicDataDisplay/Charts/Legend items/LegendResources.xaml
XAML | 98 lines | 88 code | 7 blank | 3 comment | 0 complexity | f5c07c2954829d3232b3fcd8d6ce988c MD5 | raw file
Possible License(s): CC-BY-SA-3.0
1<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 2 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 3 xmlns:local="clr-namespace:Microsoft.Research.DynamicDataDisplay.Charts"> 4 5 <!--NewLegend--> 6 <Style TargetType="{x:Type local:Legend}" BasedOn="{StaticResource {x:Type ItemsControl}}"> 7 <Setter Property="Margin" Value="10,10,10,10"/> 8 <Setter Property="HorizontalAlignment" Value="Right"/> 9 <Setter Property="VerticalAlignment" Value="Top"/> 10 <Setter Property="Panel.ZIndex" Value="10"/> 11 <Setter Property="Background" Value="White"/> 12 <Setter Property="BorderBrush" Value="DarkGray"/> 13 <Setter Property="Template"> 14 <Setter.Value> 15 <ControlTemplate TargetType="{x:Type local:Legend}"> 16 <Grid> 17 <Rectangle Name="backRect" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" 18 RadiusX="10" 19 RadiusY="10" 20 StrokeThickness="1"/> 21 <ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" 22 Margin="5"> 23 <ItemsPresenter/> 24 </ScrollViewer> 25 </Grid> 26 </ControlTemplate> 27 </Setter.Value> 28 </Setter> 29 </Style> 30 31 <local:LegendTopButtonToIsEnabledConverter x:Key="legendTopButtonConverter"/> 32 <local:LegendBottomButtonIsEnabledConverter x:Key="legendBottomButtonConverter"/> 33 34 <!--NewLegend No scroll style--> 35 <Style TargetType="{x:Type local:Legend}" BasedOn="{StaticResource {x:Type local:Legend}}" x:Key="NoScrollLegendStyle"> 36 <Setter Property="Template"> 37 <Setter.Value> 38 <ControlTemplate TargetType="{x:Type local:Legend}"> 39 <Grid> 40 <Rectangle Name="backRect" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" 41 RadiusX="10" 42 RadiusY="10" 43 StrokeThickness="1"/> 44 <Grid> 45 <Grid.RowDefinitions> 46 <RowDefinition Height="Auto"/> 47 <RowDefinition Height="*"/> 48 <RowDefinition Height="Auto"/> 49 </Grid.RowDefinitions> 50 51 <RepeatButton Content="^" Grid.Row="0" Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding ElementName=scroll}" 52 Height="18" VerticalContentAlignment="Center" Padding="0" 53 IsEnabled="{Binding VerticalOffset, ElementName=scroll, Converter={StaticResource legendTopButtonConverter}}"/> 54 55 <ScrollViewer Name="scroll" Grid.Row="1" 56 CanContentScroll="True" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Disabled" 57 Margin="5"> 58 <ItemsPresenter/> 59 </ScrollViewer> 60 <RepeatButton Content="v" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding ElementName=scroll}" 61 Height="18" VerticalContentAlignment="Center" Padding="0"> 62 <RepeatButton.IsEnabled> 63 <MultiBinding Converter="{StaticResource legendBottomButtonConverter}"> 64 <Binding Path="ExtentHeight" ElementName="scroll"/> 65 <Binding Path="ViewportHeight" ElementName="scroll"/> 66 <Binding Path="VerticalOffset" ElementName="scroll"/> 67 </MultiBinding> 68 </RepeatButton.IsEnabled> 69 </RepeatButton> 70 </Grid> 71 </Grid> 72 </ControlTemplate> 73 </Setter.Value> 74 </Setter> 75 </Style> 76 77 <!--NewLegendItem--> 78 <Style TargetType="{x:Type local:LegendItem}"> 79 <Setter Property="Template"> 80 <Setter.Value> 81 <ControlTemplate TargetType="{x:Type local:LegendItem}"> 82 <StackPanel Orientation="Horizontal"> 83 <StackPanel.ToolTip> 84 <Binding Path="(local:Legend.DetailedDescription)"/> 85 </StackPanel.ToolTip> 86 87 <ContentControl Content="{TemplateBinding local:Legend.VisualContent}" Margin="2" VerticalAlignment="Center" /> 88 <ContentControl Margin="2" VerticalAlignment="Center"> 89 <ContentControl.Content> 90 <Binding Path="(local:Legend.Description)"/> 91 </ContentControl.Content> 92 </ContentControl> 93 </StackPanel> 94 </ControlTemplate> 95 </Setter.Value> 96 </Setter> 97 </Style> 98</ResourceDictionary>