| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <UserControl x:Class="MuchInfo.Chart.WPF.Controls.QuickTimeSpan.QuickTimeSpan"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:cv="clr-namespace:MuchInfo.Chart.WPF.Converter">
- <UserControl.Resources>
- <!--ListBox Style-->
- <Style TargetType="ListBox">
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="Background" Value="{x:Null}" />
- <Setter Property="BorderBrush" Value="{x:Null}" />
- <Setter Property="Focusable" Value="False" />
- <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
- <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
- </Style>
- <!--ListBoxItem Style-->
- <Style TargetType="ListBoxItem">
- <Style.Resources>
- <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
- <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
- <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
- <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
- </Style.Resources>
- </Style>
- <!--ListBoxTimeSpanButtonDataTemplate-->
- <DataTemplate x:Key="ListBoxTimeSpanButtonDataTemplate">
- <DataTemplate.Resources>
- <cv:QuikTimeSpanConverter x:Key="QuikTimeSpanConverter" />
- </DataTemplate.Resources>
- <Border MinWidth="25" Background="LightCyan" BorderBrush="Gray" BorderThickness="1" CornerRadius="3"
- Padding="5,2">
- <TextBlock Text="{Binding Converter={StaticResource QuikTimeSpanConverter}, Mode=OneWay}"
- HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,0" />
- </Border>
- <DataTemplate.Triggers>
- <DataTrigger
- Binding="{Binding Path=IsSelected,Mode=TwoWay,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBoxItem}}}"
- Value="true">
- <Setter Property="Opacity" Value="1" />
- </DataTrigger>
- <DataTrigger
- Binding="{Binding Path=IsSelected,Mode=TwoWay,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBoxItem}}}"
- Value="false">
- <Setter Property="Opacity" Value="0.4" />
- </DataTrigger>
- </DataTemplate.Triggers>
- </DataTemplate>
- <!--ListBoxTimeSpanButtonItemsPanelTemplate-->
- <ItemsPanelTemplate x:Key="ListBoxTimeSpanButtonItemsPanelTemplate">
- <WrapPanel Orientation="Horizontal" IsItemsHost="True" ScrollViewer.VerticalScrollBarVisibility="Disabled"
- HorizontalAlignment="Center" />
- </ItemsPanelTemplate>
- </UserControl.Resources>
- <Grid>
- <ListBox x:Name="qtsListBox" ItemsSource="{Binding CycleItems,Mode=TwoWay}"
- SelectedItem="{Binding CycleType,Mode=TwoWay}"
- ItemTemplate="{DynamicResource ListBoxTimeSpanButtonDataTemplate}" Focusable="False"
- ItemsPanel="{DynamicResource ListBoxTimeSpanButtonItemsPanelTemplate}" HorizontalAlignment="Center"
- VerticalAlignment="Center" Margin="10,0" PreviewKeyDown="qtsListBox_PreviewKeyDown" />
- </Grid>
- </UserControl>
|