| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <UserControl x:Class="Muchinfo.WPF.Controls.MarQuees.CutOverControl"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- x:Name="CutOver"
- mc:Ignorable="d">
- <UserControl.Resources>
- <Style x:Key="CutOverListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
- <EventSetter Event="MouseLeftButtonUp"
- HandledEventsToo="True"
- Handler="EventSetter_OnHandler" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="HorizontalContentAlignment" Value="Left" />
- <Setter Property="VerticalContentAlignment" Value="Stretch" />
- <Setter Property="Margin" Value="0,1,10,1" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListBoxItem}">
- <Border x:Name="Bd"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Padding="{TemplateBinding Padding}"
- SnapsToDevicePixels="true">
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="BorderThickness" Value="0,0,0,1" />
- <Setter Property="Foreground" Value="PaleTurquoise" />
- <Setter Property="BorderBrush" Value="PaleTurquoise" />
- <Setter Property="Cursor" Value="Hand" />
- </Trigger>
- </ControlTemplate.Triggers>
- <!--
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsSelected" Value="true"/>
- <Condition Property="Selector.IsSelectionActive" Value="false"/>
- </MultiTrigger.Conditions>
- <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
- </MultiTrigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- -->
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="CutOverListBoxStyle1" TargetType="{x:Type ListBox}">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
- <Setter Property="BorderBrush" Value="{x:Static Themes:ClassicBorderDecorator.ClassicBorderBrush}" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
- <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
- <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="ItemsPanel">
- <Setter.Value>
- <ItemsPanelTemplate>
- <WrapPanel ItemWidth="Auto" Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListBox}">
- <Themes:ClassicBorderDecorator x:Name="Bd"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderStyle="Sunken"
- BorderThickness="{TemplateBinding BorderThickness}"
- SnapsToDevicePixels="true">
- <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
- <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </ScrollViewer>
- </Themes:ClassicBorderDecorator>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
- </Trigger>
- <Trigger Property="IsGrouping" Value="true">
- <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </UserControl.Resources>
- <Grid>
- <ListBox x:Name="ContentListBox"
- Width="{Binding ActualWidth,
- ElementName=CutOver,
- Mode=OneWay}"
- BorderBrush="{Binding BorderBrush,
- ElementName=CutOver}"
- BorderThickness="{Binding BorderThickness,
- ElementName=CutOver}"
- FontSize="{Binding FontSize,
- ElementName=CutOver}"
- Foreground="{Binding Foreground,
- ElementName=CutOver}"
- ItemContainerStyle="{DynamicResource CutOverListBoxItemStyle}"
- ItemTemplate="{Binding ItemTemplate,
- ElementName=CutOver}"
- ItemsSource="{Binding ItemsSource,
- ElementName=CutOver}"
- MouseEnter="UIElement_OnMouseEnter"
- MouseLeave="UIElement_OnMouseLeave"
- Style="{DynamicResource CutOverListBoxStyle1}" />
- </Grid>
- </UserControl>
|