PageRenderTime 43ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

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