首次提交:添加src文件夹代码
This commit is contained in:
152
Cowain.Bake.Main/Views/ComboBoxDictionary.xaml
Normal file
152
Cowain.Bake.Main/Views/ComboBoxDictionary.xaml
Normal file
@@ -0,0 +1,152 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Cowain.Bake.Main.Views">
|
||||
<!--ComboBox-->
|
||||
<!--ComBoBox项选中背景色-->
|
||||
<SolidColorBrush x:Key="ComboBoxSelectdBackground" Color="#ff8c69"/>
|
||||
<!--ComBoBox项鼠标经过背景色-->
|
||||
<SolidColorBrush x:Key="ComboBoxMouseOverBackground" Color="#ff3030"/>
|
||||
<!--ComBoBox项选中前景色-->
|
||||
<SolidColorBrush x:Key="ComboBoxSelectedForeground" Color="Black"/>
|
||||
<!--ComBoBox项鼠标经过前景色-->
|
||||
<SolidColorBrush x:Key="ComboBoxMouseOverForegrond" Color="White"/>
|
||||
|
||||
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
||||
<Grid Height="25" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Background="White" Grid.ColumnSpan="2" Opacity="0"/>
|
||||
<Path x:Name="Arrow" Grid.Column="1" Data="M 0 0 6 6 12 0 Z" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="None" Fill="#999" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter TargetName="Arrow" Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<RotateTransform CenterX="6" CenterY="3" Angle="180"></RotateTransform>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter TargetName="Arrow" Property="Margin" Value="0 0 0 2"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
|
||||
|
||||
<!--MultiComboBox普通样式-->
|
||||
<Style TargetType="{x:Type controls:MultiComboBox}">
|
||||
<Setter Property="Width" Value="200" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="MaxDropDownHeight" Value="400" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:MultiComboBox}">
|
||||
<Grid>
|
||||
<Border x:Name="Bg" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
|
||||
BorderBrush="#E0E0E0" CornerRadius="4"
|
||||
BorderThickness="1" >
|
||||
<Grid x:Name="PART_Root">
|
||||
|
||||
<Grid x:Name="PART_InnerGrid" Margin="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="0.3*" MaxWidth="30" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Margin="1" x:Name="PART_ListBoxChk" Background="#ADE5EF" SelectionMode="Multiple" BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Disabled">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Horizontal" VirtualizingStackPanel.IsVirtualizing="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="IsSelected" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<CheckBox BorderThickness="0" Background="#212f3e" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding ViewName}" IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
|
||||
<!--下拉按钮-->
|
||||
<ToggleButton x:Name="PART_DropDownToggle" IsTabStop="False"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Grid.Column="1" Template="{StaticResource ComboBoxToggleButton}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!--弹出多选列表-->
|
||||
<Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" StaysOpen="False"
|
||||
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
|
||||
<Grid Width="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}" MaxHeight="{Binding MaxDropDownHeight, RelativeSource={RelativeSource TemplatedParent}}" >
|
||||
<ListBox x:Name="PART_ListBox" SelectionMode="Multiple" BorderThickness="1 0 1 1" Background="White" ItemsSource="{Binding ItemsSource,RelativeSource={RelativeSource TemplatedParent}}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="#eaeaea" >
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}" >
|
||||
<Grid Height="22">
|
||||
<Border x:Name="bg" BorderBrush="#eaeaea" BorderThickness="0"/>
|
||||
<ContentPresenter x:Name="content" />
|
||||
<Border Background="White" Opacity="0"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="bg" Property="Background" Value="#ADD6FF" />
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsMouseOver" Value="true" />
|
||||
<Condition Property="IsSelected" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="bg" Property="Background" Value="#009BDB" />
|
||||
<Setter TargetName="bg" Property="Opacity" Value="0.7"/>
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="bg" Property="Opacity" Value="0.3" />
|
||||
<Setter Property="Foreground" Value="Gray" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<CheckBox x:Name="chk" Visibility="Hidden" IsChecked="{Binding IsCheck,Mode=TwoWay}" VerticalAlignment="Center"/>
|
||||
<CheckBox VerticalAlignment="Center" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=ListBoxItem}}" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Mode=TwoWay}" Content="{Binding Path=ViewName}" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="true">
|
||||
<Setter TargetName="chk" Property="IsChecked" Value="true"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="false">
|
||||
<Setter TargetName="chk" Property="IsChecked" Value="false"/>
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Popup>
|
||||
</Grid>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user