245 lines
17 KiB
Plaintext
245 lines
17 KiB
Plaintext
|
|
<Application
|
||
|
|
x:Class="WpfAppTest.App"
|
||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
|
xmlns:Controls="clr-namespace:WpfAppTest.Controls"
|
||
|
|
xmlns:converters="clr-namespace:WpfAppTest.Converter"
|
||
|
|
xmlns:local="clr-namespace:WpfAppTest"
|
||
|
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||
|
|
StartupUri="ModernWindow.xaml">
|
||
|
|
<Application.Resources>
|
||
|
|
<!-- <Color x:Key="RevitBgColor">#F0F0F0</Color>
|
||
|
|
<Color x:Key="RevitBorderBrush">#D0D0D0</Color>
|
||
|
|
<Color x:Key="RevitSelectedBgColor">#0078D7</Color>
|
||
|
|
<Color x:Key="RevitSelectedFgColor">White</Color>
|
||
|
|
<Color x:Key="RevitHoverBgColor">#ADD8E6</Color>
|
||
|
|
<Color x:Key="RevitDropdownBgColor">White</Color>
|
||
|
|
<Color x:Key="RevitDefaultFgColor">Black</Color>
|
||
|
|
<Color x:Key="RevitDisabledFgColor">#A0A0A0</Color>
|
||
|
|
<SolidColorBrush x:Key="RevitBgBrush" Color="{StaticResource RevitBgColor}"/>
|
||
|
|
<SolidColorBrush x:Key="RevitBorderBrush" Color="{StaticResource RevitBorderBrush}"/>
|
||
|
|
<SolidColorBrush x:Key="RevitSelectedBgBrush" Color="{StaticResource RevitSelectedBgColor}"/>
|
||
|
|
<SolidColorBrush x:Key="RevitSelectedFgBrush" Color="{StaticResource RevitSelectedFgColor}"/>
|
||
|
|
<SolidColorBrush x:Key="RevitHoverBgBrush" Color="{StaticResource RevitHoverBgColor}"/>
|
||
|
|
<SolidColorBrush x:Key="RevitDropdownBgBrush" Color="{StaticResource RevitDropdownBgColor}"/>
|
||
|
|
<SolidColorBrush x:Key="RevitDefaultFgBrush" Color="{StaticResource RevitDefaultFgColor}"/>
|
||
|
|
<SolidColorBrush x:Key="RevitDisabledFgBrush" Color="{StaticResource RevitDisabledFgColor}"/>
|
||
|
|
|
||
|
|
<DropShadowEffect x:Key="ComboBoxDropShadowEffect"
|
||
|
|
ShadowDepth="2"
|
||
|
|
Direction="270"
|
||
|
|
Color="#000000"
|
||
|
|
Opacity="0.2"
|
||
|
|
BlurRadius="5"/>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type ComboBoxItem}">
|
||
|
|
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||
|
|
<Setter Property="Padding" Value="6,4,6,4"/>
|
||
|
|
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||
|
|
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||
|
|
<Setter Property="Background" Value="Transparent"/>
|
||
|
|
<Setter Property="Foreground" Value="{StaticResource RevitDefaultFgBrush}"/>
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
||
|
|
<Border x:Name="Bd"
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
Padding="{TemplateBinding Padding}"
|
||
|
|
SnapsToDevicePixels="True">
|
||
|
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||
|
|
</Border>
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsHighlighted" Value="True">
|
||
|
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource RevitHoverBgBrush}"/>
|
||
|
|
<Setter Property="Foreground" Value="{StaticResource RevitDefaultFgBrush}"/>
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsSelected" Value="True">
|
||
|
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource RevitSelectedBgBrush}"/>
|
||
|
|
<Setter Property="Foreground" Value="{StaticResource RevitSelectedFgBrush}"/>
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter Property="Foreground" Value="{StaticResource RevitDisabledFgBrush}"/>
|
||
|
|
</Trigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
||
|
|
<Grid>
|
||
|
|
<Border x:Name="Border"
|
||
|
|
Background="{StaticResource RevitBgBrush}" BorderBrush="{StaticResource RevitBorderBrush}" BorderThickness="1" CornerRadius="0"/>
|
||
|
|
|
||
|
|
<Path x:Name="Arrow"
|
||
|
|
HorizontalAlignment="Center"
|
||
|
|
VerticalAlignment="Center"
|
||
|
|
Margin="0,1,0,0"
|
||
|
|
Fill="{StaticResource RevitDefaultFgBrush}"
|
||
|
|
Data="M0,0 L4,4 L8,0 Z" />
|
||
|
|
</Grid>
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
|
<Setter TargetName="Border" Property="Background" Value="{StaticResource RevitHoverBgBrush}"/>
|
||
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource RevitHoverBgBrush}"/>
|
||
|
|
<Setter TargetName="Arrow" Property="Fill" Value="{StaticResource RevitDefaultFgBrush}"/>
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsChecked" Value="True">
|
||
|
|
<Setter TargetName="Border" Property="Background" Value="{StaticResource RevitHoverBgBrush}"/>
|
||
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource RevitHoverBgBrush}"/>
|
||
|
|
<Setter TargetName="Arrow" Property="Fill" Value="{StaticResource RevitDefaultFgBrush}"/>
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter TargetName="Border" Property="Background" Value="{StaticResource RevitBgBrush}"/>
|
||
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource RevitBorderBrush}"/>
|
||
|
|
<Setter TargetName="Arrow" Property="Fill" Value="{StaticResource RevitDisabledFgBrush}"/>
|
||
|
|
<Setter TargetName="Border" Property="Opacity" Value="0.6"/>
|
||
|
|
</Trigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
|
||
|
|
<Style x:Key="MyRevitComboBoxStyle" TargetType="{x:Type ComboBox}">
|
||
|
|
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||
|
|
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
||
|
|
<Setter Property="Foreground" Value="{StaticResource RevitDefaultFgBrush}"/>
|
||
|
|
<Setter Property="Background" Value="{StaticResource RevitBgBrush}"/>
|
||
|
|
<Setter Property="BorderBrush" Value="{StaticResource RevitBorderBrush}"/>
|
||
|
|
<Setter Property="BorderThickness" Value="1"/>
|
||
|
|
<Setter Property="Padding" Value="6,2,0,2"/>
|
||
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ComboBox}">
|
||
|
|
<Grid x:Name="templateRoot">
|
||
|
|
<Grid.ColumnDefinitions>
|
||
|
|
<ColumnDefinition/>
|
||
|
|
<ColumnDefinition Width="20"/>
|
||
|
|
</Grid.ColumnDefinitions>
|
||
|
|
|
||
|
|
<VisualStateManager.VisualStateGroups>
|
||
|
|
<VisualStateGroup x:Name="CommonStates">
|
||
|
|
<VisualState x:Name="Normal"/>
|
||
|
|
<VisualState x:Name="MouseOver">
|
||
|
|
<Storyboard>
|
||
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Bg" Storyboard.TargetProperty="Background">
|
||
|
|
<DiscreteObjectKeyFrame KeyTime="0">
|
||
|
|
<DiscreteObjectKeyFrame.Value>
|
||
|
|
<SolidColorBrush Color="{StaticResource RevitHoverBgColor}"/>
|
||
|
|
</DiscreteObjectKeyFrame.Value>
|
||
|
|
</DiscreteObjectKeyFrame>
|
||
|
|
</ObjectAnimationUsingKeyFrames>
|
||
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Bg" Storyboard.TargetProperty="BorderBrush">
|
||
|
|
<DiscreteObjectKeyFrame KeyTime="0">
|
||
|
|
<DiscreteObjectKeyFrame.Value>
|
||
|
|
<SolidColorBrush Color="{StaticResource RevitHoverBgColor}"/>
|
||
|
|
</DiscreteObjectKeyFrame.Value>
|
||
|
|
</DiscreteObjectKeyFrame>
|
||
|
|
</ObjectAnimationUsingKeyFrames>
|
||
|
|
</Storyboard>
|
||
|
|
</VisualState>
|
||
|
|
<VisualState x:Name="Disabled">
|
||
|
|
<Storyboard>
|
||
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="templateRoot" Storyboard.TargetProperty="Opacity">
|
||
|
|
<DiscreteObjectKeyFrame KeyTime="0">
|
||
|
|
<DiscreteObjectKeyFrame.Value>
|
||
|
|
<sys:Double>0.6</sys:Double>
|
||
|
|
</DiscreteObjectKeyFrame.Value>
|
||
|
|
</DiscreteObjectKeyFrame>
|
||
|
|
</ObjectAnimationUsingKeyFrames>
|
||
|
|
</Storyboard>
|
||
|
|
</VisualState>
|
||
|
|
</VisualStateGroup>
|
||
|
|
<VisualStateGroup x:Name="FocusStates">
|
||
|
|
<VisualState x:Name="Focused">
|
||
|
|
<Storyboard>
|
||
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Bg" Storyboard.TargetProperty="BorderBrush">
|
||
|
|
<DiscreteObjectKeyFrame KeyTime="0">
|
||
|
|
<DiscreteObjectKeyFrame.Value>
|
||
|
|
<SolidColorBrush Color="{StaticResource RevitHoverBgColor}"/>
|
||
|
|
</DiscreteObjectKeyFrame.Value>
|
||
|
|
</DiscreteObjectKeyFrame>
|
||
|
|
</ObjectAnimationUsingKeyFrames>
|
||
|
|
</Storyboard>
|
||
|
|
</VisualState>
|
||
|
|
<VisualState x:Name="Unfocused"/>
|
||
|
|
<VisualState x:Name="FocusedDropDown"/>
|
||
|
|
</VisualStateGroup>
|
||
|
|
<VisualStateGroup x:Name="ValidationStates">
|
||
|
|
<VisualState x:Name="Valid"/>
|
||
|
|
<VisualState x:Name="InvalidUnfocused"/>
|
||
|
|
<VisualState x:Name="InvalidFocused"/>
|
||
|
|
</VisualStateGroup>
|
||
|
|
</VisualStateManager.VisualStateGroups>
|
||
|
|
|
||
|
|
<Border x:Name="Bg"
|
||
|
|
Grid.ColumnSpan="2"
|
||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
CornerRadius="0"/>
|
||
|
|
|
||
|
|
<ContentPresenter x:Name="ContentSite"
|
||
|
|
Grid.Column="0" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
Margin="{TemplateBinding Padding}"
|
||
|
|
IsHitTestVisible="False"
|
||
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
||
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||
|
|
|
||
|
|
<ToggleButton x:Name="ToggleButton"
|
||
|
|
Grid.Column="1" Template="{StaticResource ComboBoxToggleButton}"
|
||
|
|
Focusable="False"
|
||
|
|
ClickMode="Press"
|
||
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
|
||
|
|
|
||
|
|
<TextBox x:Name="PART_EditableTextBox"
|
||
|
|
Grid.Column="0" Style="{x:Null}"
|
||
|
|
Template="{x:Null}"
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
|
Margin="{TemplateBinding Padding}"
|
||
|
|
Visibility="Hidden"
|
||
|
|
Focusable="True"
|
||
|
|
IsReadOnly="{TemplateBinding IsReadOnly}"/>
|
||
|
|
|
||
|
|
<Popup x:Name="PART_Popup"
|
||
|
|
AllowsTransparency="True"
|
||
|
|
Placement="Bottom"
|
||
|
|
IsOpen="{TemplateBinding IsDropDownOpen}"
|
||
|
|
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
|
||
|
|
Margin="0"
|
||
|
|
Grid.ColumnSpan="2">
|
||
|
|
<Border x:Name="DropDownBorder"
|
||
|
|
BorderBrush="{StaticResource RevitBorderBrush}"
|
||
|
|
BorderThickness="1"
|
||
|
|
Background="{StaticResource RevitDropdownBgBrush}"
|
||
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||
|
|
MinWidth="{TemplateBinding ActualWidth}"
|
||
|
|
Effect="{StaticResource ComboBoxDropShadowEffect}">
|
||
|
|
<ScrollViewer Margin="0" SnapsToDevicePixels="True"
|
||
|
|
VerticalScrollBarVisibility="Hidden"
|
||
|
|
HorizontalScrollBarVisibility="Hidden">
|
||
|
|
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"
|
||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||
|
|
</ScrollViewer>
|
||
|
|
</Border>
|
||
|
|
</Popup>
|
||
|
|
</Grid>
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsEditable" Value="True">
|
||
|
|
<Setter Property="IsTabStop" Value="False"/>
|
||
|
|
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
|
||
|
|
<Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
|
||
|
|
</Trigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>-->
|
||
|
|
<!--<ResourceDictionary Source="/Generic.xaml" />-->
|
||
|
|
<ResourceDictionary Source="/ModernStyles.xaml" />
|
||
|
|
</Application.Resources>
|
||
|
|
</Application>
|