123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <ResourceDictionary
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:wpf="clr-namespace:FWindSoft.Wpf"
- xmlns:local="clr-namespace:FWindSoft.Wpf.Controls">
- <LinearGradientBrush x:Key="ActiveButtonBrush" StartPoint="0,0" EndPoint="0,1">
- <LinearGradientBrush.GradientStops>
- <GradientStop Color="#EAF6FD" Offset="0.15" />
- <GradientStop Color="#D9F0FC" Offset=".5" />
- <GradientStop Color="#BEE6FD" Offset=".5" />
- <GradientStop Color="#A7D9F5" Offset="1" />
- </LinearGradientBrush.GradientStops>
- </LinearGradientBrush>
- <SolidColorBrush x:Key="ActiveBorderBrush" Color="DarkBlue" />
- <!-- Style for a ListBoxItem displayed inside the embedded list box, to make it a check box when mode = multiple. -->
- <Style x:Key="CheckBoxedItemStyleKey" TargetType="{x:Type ListBoxItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListBoxItem}">
- <Border Background="Transparent">
- <CheckBox Focusable="false"
- Foreground="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}"
- BorderBrush="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}, Path=Foreground}"
- Content="{TemplateBinding ContentPresenter.Content}"
- IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!-- Style for a ListBoxItem displayed inside the embedded list box, when mode = single -->
- <Style x:Key="NormalItemStyleKey" TargetType="{x:Type ListBoxItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListBoxItem}">
- <Border Name="border"
- Margin="0,-1"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="1"
- SnapsToDevicePixels="true">
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="BorderBrush" Value="{x:Static SystemColors.HighlightBrush}" />
- </Trigger>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="Background" Value="{x:Static SystemColors.HighlightBrush}" />
- <Setter Property="Foreground" Value="{x:Static SystemColors.HighlightTextBrush}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="FocusVisualStyle">
- <Setter Property="Control.Template">
- <Setter.Value>
- <ControlTemplate>
- <Border>
- <Rectangle
- Margin="2"
- StrokeThickness="1"
- Stroke="#b0000000"
- StrokeDashArray="1 2"/>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!-- Template for the toggle button which is the main view of the control -->
- <ControlTemplate x:Key="MultiSelectComboBoxToggleButtonTemplate" TargetType="{x:Type Button}">
- <Border BorderThickness="{TemplateBinding BorderThickness}"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- SnapsToDevicePixels="true">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <ContentPresenter Content="{TemplateBinding Content}" />
- <Border Name="arrowBorder" Grid.Column="1" Width="16" BorderBrush="{TemplateBinding BorderBrush}">
- <Path HorizontalAlignment="Center" VerticalAlignment="Center"
- Fill="{TemplateBinding BorderBrush}" Data="M 0 0 L 7 0 L 3.5 4 Z" />
- </Border>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="arrowBorder" Property="Background" Value="{StaticResource ActiveButtonBrush}" />
- <Setter TargetName="arrowBorder" Property="BorderThickness" Value="1,0,0,0" />
- </Trigger>
- <!--<Trigger Property="IsChecked" Value="True">
- <Setter TargetName="arrowBorder" Property="Background" Value="{StaticResource ActiveButtonBrush}" />
- <Setter TargetName="arrowBorder" Property="BorderThickness" Value="1,0,0,0" />
- </Trigger>-->
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <ControlTemplate x:Key="SearchComboBoxTemplate" TargetType="{x:Type local:SearchComboBox}">
- <Grid >
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="Auto"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBox IsReadOnly="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsReadOnly}" BorderThickness="1,1,0,1" BorderBrush="Black" Name="PART_SearchText" Margin="1,0,0,0" Grid.Column="0" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text,Mode=TwoWay}"></TextBox>
- <Button Grid.Column="1" Name="PART_Button" IsTabStop="False"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Template="{StaticResource MultiSelectComboBoxToggleButtonTemplate}"
- >
- </Button>
- <Popup Name="PART_Popup"
- StaysOpen="False"
- AllowsTransparency="True"
- Placement="Bottom"
- IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen,Mode=TwoWay}"
- FocusManager.IsFocusScope="True"
- FocusManager.FocusedElement="{Binding ElementName=List}"
- PopupAnimation="Slide">
- <Border Name="Shadow"
- MaxHeight="{TemplateBinding MaxDropDownHeight}"
- MinWidth="{TemplateBinding ActualWidth}">
- <Border BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Background="{TemplateBinding Background}">
- <StackPanel>
- <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}" >
- <ItemsPresenter x:Name="List" Margin="{TemplateBinding Padding}" KeyboardNavigation.DirectionalNavigation="Contained"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </ScrollViewer>
- </StackPanel>
- </Border>
- </Border>
- </Popup>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
- <Setter TargetName="Shadow" Property="Margin" Value="0,0,5,5" />
- <!--<Setter TargetName="Shadow" Property="Color" Value="#71000000" />-->
- </Trigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="BorderBrush" Value="{StaticResource ActiveBorderBrush}" />
- </Trigger>
- <!--<Trigger SourceName="toggleButton" Property="IsChecked" Value="True">
- <Setter Property="BorderBrush" Value="{StaticResource ActiveBorderBrush}" />
- </Trigger>-->
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <!-- Style which defines the MultiComboBox -->
- <Style TargetType="{x:Type local:SearchComboBox}">
- <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
- <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
- <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
- <Setter Property="MinWidth" Value="120"/>
- <Setter Property="MinHeight" Value="20"/>
- <Setter Property="Foreground" Value="{x:Static SystemColors.WindowTextBrush}" />
- <Setter Property="BorderBrush" Value="{x:Static SystemColors.WindowTextBrush}" />
- <Setter Property="Background" Value="{x:Static SystemColors.WindowBrush}" />
- <Setter Property="BorderThickness" Value="1" />
- <Setter Property="IsTabStop" Value="True" />
- <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" />
- <Setter Property="Template" Value="{StaticResource SearchComboBoxTemplate}" />
- <Setter Property="ItemContainerStyle" Value="{StaticResource NormalItemStyleKey}" />
- </Style>
- </ResourceDictionary>
|