123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <Style TargetType="ComboBox">
- <Setter Property="FontFamily" Value="Arial,SimSun" />
- <Setter Property="Background" Value="#FFDCF7F6"></Setter>
- </Style>
- <Style TargetType="ComboBox" x:Key="EventComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
- <Setter Property="Height" Value="28" />
- <Setter Property="FontSize" Value="14" />
- </Style>
- <Style TargetType="ToggleButton" x:Key="ComboxStyleBtn">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate>
- <!--下拉按钮内部背景色-->
- <Border x:Name="Back" Background="#56b6e6" BorderThickness="1" BorderBrush="Transparent">
- <!--下拉按钮内边框-->
- <Path Name="PathFill" Fill="#03ffea" Width="10" Height="6" StrokeThickness="0" Data="M5,0 L10,10 L0,10 z" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
- <Path.RenderTransform>
- <TransformGroup>
- <ScaleTransform/>
- <SkewTransform/>
- <RotateTransform Angle="180"/>
- <TranslateTransform/>
- </TransformGroup>
- </Path.RenderTransform>
- </Path>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="PathFill" Property="Fill" Value="White"></Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style TargetType="ToggleButton" x:Key="ComboxStyleBtnLabel">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate>
- <Label Background="{TemplateBinding Background}" VerticalAlignment="Stretch" Grid.Column="0" Foreground="{TemplateBinding Foreground}" BorderThickness="0" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Margin="0" ></Label>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style TargetType="ComboBox" x:Key="TopFrameComboBoxStyle">
- <Setter Property="ItemTemplate">
- <Setter.Value>
- <DataTemplate>
- <ContentControl>
- <ContentControl.Style>
- <Style TargetType="ContentControl">
- <Setter Property="Background" Value="{StaticResource MessagesInformationBackgroundBrush}"/>
- <Style.Triggers>
- <DataTrigger Binding="{Binding Category}" Value="Error">
- <Setter Property="Foreground" Value="{StaticResource MessagesErrorForegroundBrush}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding Category}" Value="Warning">
- <Setter Property="Foreground" Value="{StaticResource MessagesWarningForegroundBrush}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding Category}" Value="Information">
- <Setter Property="Foreground" Value="{StaticResource MessagesInformationForegroundBrush}"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ContentControl.Style>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="80"/>
- <ColumnDefinition Width="120"/>
- <ColumnDefinition Width="80"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <TextBlock Grid.Column="0" Text="{Binding UtcTimestamp, Converter={StaticResource UtcTimeToTextConverter}, ConverterParameter=HH:mm:ss.fff}" />
- <TextBlock Grid.Column="1" Text="{Binding Source}" Margin="8,0,0,0" />
- <TextBlock Grid.Column="2" Text="{Binding Type}" Margin="8,0,0,0"/>
- <TextBlock Grid.Column="3" Text="{Binding Message}" Margin="8,0,0,0"/>
- </Grid>
- </ContentControl>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style TargetType="ComboBox" x:Key="TopPanelComboBoxStyle">
- <Setter Property="ItemContainerStyle">
- <Setter.Value>
- <!--ComBoxItem-->
- <Style TargetType="ComboBoxItem">
- <Setter Property="MinHeight" Value="22"></Setter>
- <Setter Property="MinWidth" Value="60"></Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ComboBoxItem">
- <Border Name="Back" Background="{TemplateBinding Background}" >
- <ContentPresenter ContentSource="{Binding Source}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" ></ContentPresenter>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ComboBox">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="0.7*"/>
- <ColumnDefinition Width="0.3*" MaxWidth="30"/>
- </Grid.ColumnDefinitions>
- <!--文字区域背景和边线样式-->
- <Border Grid.Column="0" BorderThickness="1" BorderBrush="Gray" CornerRadius="1,0,0,1" >
- <Label Background="{TemplateBinding Background}" VerticalAlignment="Stretch" Grid.Column="0" Foreground="{TemplateBinding Foreground}" BorderThickness="0" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Content="{TemplateBinding Text}" Margin="0" ></Label>
- <!--<ToggleButton BorderThickness="0" BorderBrush="Gray" Style="{StaticResource ComboxStyleBtnLabel}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"></ToggleButton>-->
- </Border>
- <!--右侧下拉button设置-->
- <Border Grid.Column="1" BorderThickness="0,1,1,1" BorderBrush="Gray" CornerRadius="0,1,1,0">
- <ToggleButton BorderThickness="3" BorderBrush="Gray" Style="{StaticResource ComboxStyleBtn}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"></ToggleButton>
- </Border>
- <!--弹出popup整体设置-->
- <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide" >
- <!--弹出popup边框-->
- <Border CornerRadius="1" BorderBrush="Gray" BorderThickness="1,0,1,1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
- <Border.Effect>
- <DropShadowEffect Color="LightGray" BlurRadius="2" ShadowDepth="0" Opacity="1"/>
- </Border.Effect>
- <!--下拉幕布边界背景设置 MaxHeight="{TemplateBinding MaxDropDownHeight}"-->
- <ScrollViewer Margin="0,0,0,0" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" BorderBrush="Gray" BorderThickness="2" >
- <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
- <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="LightGray" />
- </ScrollViewer>
- </Border>
- </Popup>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|