/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
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="clr-namespace:Microsoft.Research.DynamicDataDisplay.Charts">
-
- <!--NewLegend-->
- <Style TargetType="{x:Type local:Legend}" BasedOn="{StaticResource {x:Type ItemsControl}}">
- <Setter Property="Margin" Value="10,10,10,10"/>
- <Setter Property="HorizontalAlignment" Value="Right"/>
- <Setter Property="VerticalAlignment" Value="Top"/>
- <Setter Property="Panel.ZIndex" Value="10"/>
- <Setter Property="Background" Value="White"/>
- <Setter Property="BorderBrush" Value="DarkGray"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type local:Legend}">
- <Grid>
- <Rectangle Name="backRect" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}"
- RadiusX="10"
- RadiusY="10"
- StrokeThickness="1"/>
- <ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
- Margin="5">
- <ItemsPresenter/>
- </ScrollViewer>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <local:LegendTopButtonToIsEnabledConverter x:Key="legendTopButtonConverter"/>
- <local:LegendBottomButtonIsEnabledConverter x:Key="legendBottomButtonConverter"/>
-
- <!--NewLegend No scroll style-->
- <Style TargetType="{x:Type local:Legend}" BasedOn="{StaticResource {x:Type local:Legend}}" x:Key="NoScrollLegendStyle">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type local:Legend}">
- <Grid>
- <Rectangle Name="backRect" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}"
- RadiusX="10"
- RadiusY="10"
- StrokeThickness="1"/>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
-
- <RepeatButton Content="^" Grid.Row="0" Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding ElementName=scroll}"
- Height="18" VerticalContentAlignment="Center" Padding="0"
- IsEnabled="{Binding VerticalOffset, ElementName=scroll, Converter={StaticResource legendTopButtonConverter}}"/>
-
- <ScrollViewer Name="scroll" Grid.Row="1"
- CanContentScroll="True" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Disabled"
- Margin="5">
- <ItemsPresenter/>
- </ScrollViewer>
- <RepeatButton Content="v" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding ElementName=scroll}"
- Height="18" VerticalContentAlignment="Center" Padding="0">
- <RepeatButton.IsEnabled>
- <MultiBinding Converter="{StaticResource legendBottomButtonConverter}">
- <Binding Path="ExtentHeight" ElementName="scroll"/>
- <Binding Path="ViewportHeight" ElementName="scroll"/>
- <Binding Path="VerticalOffset" ElementName="scroll"/>
- </MultiBinding>
- </RepeatButton.IsEnabled>
- </RepeatButton>
- </Grid>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <!--NewLegendItem-->
- <Style TargetType="{x:Type local:LegendItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type local:LegendItem}">
- <StackPanel Orientation="Horizontal">
- <StackPanel.ToolTip>
- <Binding Path="(local:Legend.DetailedDescription)"/>
- </StackPanel.ToolTip>
-
- <ContentControl Content="{TemplateBinding local:Legend.VisualContent}" Margin="2" VerticalAlignment="Center" />
- <ContentControl Margin="2" VerticalAlignment="Center">
- <ContentControl.Content>
- <Binding Path="(local:Legend.Description)"/>
- </ContentControl.Content>
- </ContentControl>
- </StackPanel>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>