Loading files
797882a6aThis file is pinned to the selected release. Download the original to open it in your design tool.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:IDE.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Brushes.xaml" />
</ResourceDictionary.MergedDictionaries>
<ControlTemplate x:Key="UnitCmbComboBoxToggleButton"
TargetType="ToggleButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- CornerRadius="2" -->
<Border x:Name="Border"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}"
BorderBrush="{StaticResource UnitCmbNormalBorderBrush}"
BorderThickness="0" />
<Border Margin="2,0"
Grid.Column="1"
Background="Transparent"
BorderBrush="Transparent">
<Path x:Name="Arrow"
Fill="{StaticResource UnitCmbGlyphBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 L 4 4 L 8 0 Z" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ToggleButton.IsMouseOver"
Value="true">
<Setter TargetName="Border"
Property="Background"
Value="{StaticResource UnitCmbDarkBrush}" />
</Trigger>
<Trigger Property="ToggleButton.IsChecked"
Value="true">
<Setter TargetName="Border"
Property="Background"
Value="{StaticResource UnitCmbPressedBrush}" />
</Trigger>
<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Background"
Value="{StaticResource UnitCmbDisabledBackgroundBrush}" />
<Setter Property="BorderBrush"
Value="{StaticResource UnitCmbDisabledBorderBrush}" />
<Setter Property="Foreground"
Value="{StaticResource UnitCmbDisabledForegroundBrush}" />
<Setter TargetName="Arrow"
Property="Fill"
Value="{StaticResource UnitCmbDisabledForegroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="ComboBoxTextBox"
TargetType="TextBox">
<Border x:Name="PART_ContentHost"
Focusable="False"
Background="{TemplateBinding Background}" />
</ControlTemplate>
<Style TargetType="{x:Type local:UnitCombobox}">
<Setter Property="SnapsToDevicePixels"
Value="true" />
<!-- Setter Property="OverridesDefaultStyle" Value="true"/ Not sure whether this is required as it causes an error -->
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility"
Value="Auto" />
<Setter Property="ScrollViewer.CanContentScroll"
Value="true" />
<Setter Property="BorderBrush"
Value="Beige" />
<Setter Property="BorderThickness"
Value="2" />
<Setter Property="Background"
Value="White" />
<!-- Setter Property="MinWidth" Value="120"/ -->
<!-- Setter Property="MinHeight" Value="20"/ -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:UnitCombobox}">
<Border x:Name="ControlBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Margin="3,3,23,3" -->
<ContentPresenter Name="ContentSite"
IsHitTestVisible="False"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
MinWidth="35"
Margin="1,0"
Grid.Column="0" />
<TextBox x:Name="PART_EditableTextBox"
Template="{StaticResource ComboBoxTextBox}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Right"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
MinWidth="35"
Margin="1,0"
Focusable="True"
Visibility="Hidden"
IsReadOnly="{TemplateBinding IsReadOnly}"
Grid.Column="0" />
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Grid.Row="1"
Padding="0"
Margin="1,0,3,0"
BorderThickness="0"
ToolTip="{Binding SelectedItem.DisplayNameLong}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
local:ContextMenuBehaviour.MenuList="{Binding ElementName=contextMenuOnUniLabel1}">
<Label.ContextMenu>
<ContextMenu Name="contextMenuOnUniLabel1"
ItemsSource="{Binding Path=UnitList}"
Placement="Top">
<ContextMenu.ItemContainerStyle>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Command"
Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}, Path=DataContext.SetSelectedItemCommand}" />
<Setter Property="CommandParameter"
Value="{Binding}" />
<Setter Property="Header"
Value="{Binding DisplayNameLongWithShort}" />
</Style>
</ContextMenu.ItemContainerStyle>
</ContextMenu>
</Label.ContextMenu>
<TextBlock Text="{Binding SelectedItem.DisplayNameShort}"
Name="LabelTextBlock">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="true">
<Setter Property="TextDecorations"
Value="Underline" />
<Setter Property="Cursor"
Value="Hand" />
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Label>
<ToggleButton Name="ToggleButton"
Margin="0"
Padding="0"
Template="{StaticResource UnitCmbComboBoxToggleButton}"
Grid.Column="1"
Focusable="false"
VerticalAlignment="Stretch"
IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press">
</ToggleButton>
</Grid>
<Popup Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid Name="DropDown"
SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder"
Background="{StaticResource UnitCmbWindowBackgroundBrush}"
BorderThickness="1"
BorderBrush="{StaticResource UnitCmbSolidBorderBrush}" />
<ScrollViewer Margin="4,6,4,6"
SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True"
KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Grid>
</Popup>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter TargetName="ControlBorder"
Property="BorderBrush"
Value="{StaticResource UnitCmbHighlighColorBrush}" />
<Setter TargetName="ToggleButton"
Property="Background"
Value="{StaticResource UnitCmbDarkBrush}" />
</Trigger>
<Trigger Property="HasItems"
Value="false">
<Setter TargetName="DropDownBorder"
Property="MinHeight"
Value="95" />
</Trigger>
<Trigger Property="IsEnabled"
Value="false">
<Setter Property="Foreground"
Value="{StaticResource UnitCmbDisabledForegroundBrush}" />
</Trigger>
<Trigger Property="IsGrouping"
Value="true">
<Setter Property="ScrollViewer.CanContentScroll"
Value="false" />
</Trigger>
<Trigger SourceName="Popup"
Property="Popup.AllowsTransparency"
Value="true">
<Setter TargetName="DropDownBorder"
Property="CornerRadius"
Value="4" />
<Setter TargetName="DropDownBorder"
Property="Margin"
Value="0,2,0,0" />
</Trigger>
<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>