298
src/Ursa.Themes.Semi/Controls/TreeComboBox.axaml
Normal file
298
src/Ursa.Themes.Semi/Controls/TreeComboBox.axaml
Normal file
@@ -0,0 +1,298 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"
|
||||
xmlns:converters1="clr-namespace:Ursa.Converters;assembly=Ursa"
|
||||
xmlns:iri="https://irihi.tech/shared"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
<!-- Add Resources Here -->
|
||||
|
||||
<converters:MarginMultiplierConverter
|
||||
x:Key="LeftMarginConverter"
|
||||
Indent="20"
|
||||
Left="True" />
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:TreeComboBox}" TargetType="u:TreeComboBox">
|
||||
<Setter Property="Padding" Value="{DynamicResource ComboBoxSelectorDefaultPadding}" />
|
||||
<Setter Property="FocusAdorner" Value="{x:Null}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ComboBoxSelectorBackground}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ComboBoxSelectorCornerRadius}" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource ComboBoxDefaultHeight}" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:TreeComboBox">
|
||||
<Grid MinWidth="{TemplateBinding MinHeight}" ColumnDefinitions="Auto, *, Auto, Auto, Auto">
|
||||
<Border
|
||||
Name="Background"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="5"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="0"
|
||||
Margin="8,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{TemplateBinding InnerLeftContent}"
|
||||
Foreground="{DynamicResource TextBoxInnerForeground}"
|
||||
IsVisible="{TemplateBinding InnerLeftContent,
|
||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||
<TextBlock
|
||||
Name="PlaceholderTextBlock"
|
||||
Grid.Column="1"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsVisible="{TemplateBinding SelectionBoxItem,
|
||||
Converter={x:Static ObjectConverters.IsNull}}"
|
||||
Opacity="0.3"
|
||||
Text="{TemplateBinding Watermark}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<ContentPresenter
|
||||
Grid.Column="1"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Center"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding SelectionBoxItem}">
|
||||
<ContentPresenter.ContentTemplate>
|
||||
<MultiBinding Converter="{x:Static converters1:SelectionBoxTemplateConverter.Instance}">
|
||||
<TemplateBinding Property="SelectedItemTemplate" />
|
||||
<TemplateBinding Property="ItemTemplate" />
|
||||
</MultiBinding>
|
||||
</ContentPresenter.ContentTemplate>
|
||||
</ContentPresenter>
|
||||
<Button
|
||||
Name="PART_ClearButton"
|
||||
Grid.Column="2"
|
||||
Command="{Binding $parent[iri:IClearControl].Clear}"
|
||||
IsVisible="False"
|
||||
Theme="{DynamicResource InnerIconButton}"
|
||||
Content="{DynamicResource IconButtonClearData}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="3"
|
||||
Margin="0 0 8 0"
|
||||
VerticalAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{TemplateBinding InnerRightContent}"
|
||||
Foreground="{DynamicResource TextBoxInnerForeground}"
|
||||
IsVisible="{TemplateBinding InnerRightContent,
|
||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||
<Panel
|
||||
Grid.Column="4"
|
||||
Width="32"
|
||||
Background="Transparent"
|
||||
IsHitTestVisible="True">
|
||||
<PathIcon
|
||||
x:Name="DropDownGlyph"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Margin="0,0,10,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Data="{DynamicResource ComboBoxIcon}"
|
||||
Foreground="{DynamicResource ComboBoxIconDefaultForeground}"
|
||||
UseLayoutRounding="False" />
|
||||
</Panel>
|
||||
<Popup
|
||||
Name="{x:Static iri:PartNames.PART_Popup}"
|
||||
Grid.Column="0"
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
ClipToBounds="False"
|
||||
InheritsTransform="True"
|
||||
IsLightDismissEnabled="True"
|
||||
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||
PlacementTarget="Background"
|
||||
WindowManagerAddShadowHint="False">
|
||||
<Border
|
||||
Name="PopupBorder"
|
||||
Margin="0,4"
|
||||
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
||||
Background="{DynamicResource ComboBoxPopupBackground}"
|
||||
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
||||
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="6">
|
||||
<DockPanel LastChildFill="True">
|
||||
<ContentPresenter
|
||||
Name="PART_PopupHeader"
|
||||
Margin="8,8 8 0"
|
||||
IsVisible="{TemplateBinding PopupInnerTopContent,
|
||||
Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
Content="{TemplateBinding PopupInnerTopContent}"
|
||||
DockPanel.Dock="Top" />
|
||||
<ContentPresenter
|
||||
Name="PART_PopupFooter"
|
||||
Margin="8 0 8 8"
|
||||
IsVisible="{TemplateBinding PopupInnerBottomContent,
|
||||
Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
Content="{TemplateBinding PopupInnerBottomContent}"
|
||||
DockPanel.Dock="Bottom" />
|
||||
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}">
|
||||
<ItemsPresenter ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^.clearButton, ^.ClearButton">
|
||||
<Style Selector="^:pointerover /template/ Button#PART_ClearButton">
|
||||
<Setter Property="IsVisible" Value="{Binding $parent[u:TreeComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Large">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource ComboBoxLargeHeight}"/>
|
||||
</Style>
|
||||
<Style Selector="^.Small">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource ComboBoxSmallHeight}"/>
|
||||
</Style>
|
||||
|
||||
<!-- Pointerover State -->
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource ComboBoxSelectorPointeroverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorPointeroverBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ PathIcon#DropDownGlyph">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ComboBoxIconPointeroverForeground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Pressed State -->
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="Background" Value="{DynamicResource ComboBoxSelectorPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorPressedBorderBrush}" />
|
||||
<Style Selector="^ /template/ PathIcon#DropDownGlyph">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ComboBoxIconPressedForeground}" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:dropdownopen">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorPressedBorderBrush}" />
|
||||
</Style>
|
||||
|
||||
<!-- Disabled State -->
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Background" Value="{DynamicResource ComboBoxSelectorDisabledBackground}" />
|
||||
<Style Selector="^ /template/ ContentControl#ContentPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ComboBoxDisabledForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ TextBlock#PlaceholderTextBlock">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ComboBoxDisabledForeground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ PathIcon#DropDownGlyph">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ComboBoxIconDisabledForeground}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<!-- Error State -->
|
||||
<Style Selector="^:error">
|
||||
<Style Selector="^ /template/ Border#Background">
|
||||
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover /template/ Border#Background">
|
||||
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#Background">
|
||||
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
</Style>
|
||||
<Style Selector="^:focus /template/ Border#Background">
|
||||
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:TreeComboBoxItem}" TargetType="u:TreeComboBoxItem">
|
||||
<Setter Property="Background" Value="{DynamicResource TreeViewItemDefaultBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemDefaultForeground}" />
|
||||
<Setter Property="CornerRadius" Value="3" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:TreeComboBoxItem">
|
||||
<StackPanel>
|
||||
<Border
|
||||
Name="PART_LayoutRoot"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
TemplatedControl.IsTemplateFocusTarget="True">
|
||||
<Grid
|
||||
Name="{x:Static iri:PartNames.PART_Header}"
|
||||
Margin="{TemplateBinding Level,
|
||||
Mode=OneWay,
|
||||
Converter={StaticResource LeftMarginConverter}}"
|
||||
ColumnDefinitions="Auto, *">
|
||||
<ToggleButton
|
||||
Name="PART_ExpandCollapseChevron"
|
||||
Grid.Column="0"
|
||||
Padding="{DynamicResource TreeViewItemIconMargin}"
|
||||
Focusable="False"
|
||||
IsChecked="{TemplateBinding IsExpanded,
|
||||
Mode=TwoWay}"
|
||||
Theme="{DynamicResource ToggleButtonTreeViewItemIconButton}" />
|
||||
<ContentPresenter
|
||||
Name="{x:Static iri:PartNames.PART_HeaderPresenter}"
|
||||
Grid.Column="1"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
Padding="{DynamicResource TreeViewItemPadding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
Focusable="False"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ItemsPresenter
|
||||
Name="{x:Static iri:PartNames.PART_ItemsPresenter}"
|
||||
IsVisible="{TemplateBinding IsExpanded}"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<!-- Pointerover state -->
|
||||
<Style Selector="^ /template/ Border#PART_LayoutRoot:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource TreeViewItemPointeroverBackground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Pressed state -->
|
||||
<Style Selector="^:pressed /template/ Border#PART_LayoutRoot:pointerover">
|
||||
<Setter Property="Background" Value="{DynamicResource TreeViewItemPressedBackground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Disabled state -->
|
||||
<Style Selector="^:disabled /template/ Border#PART_LayoutRoot">
|
||||
<Setter Property="Background" Value="{DynamicResource TreeViewItemDisabledBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_HeaderPresenter">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemDisabledForeground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Selected state -->
|
||||
<Style Selector="^:selected /template/ Border#PART_LayoutRoot">
|
||||
<Setter Property="Background" Value="{DynamicResource TreeViewItemSelectedBackground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Disabled Selected state -->
|
||||
<Style Selector="^:disabled:selected /template/ Border#PART_LayoutRoot">
|
||||
<Setter Property="Background" Value="{DynamicResource TreeViewItemSelectedDisabledBackground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:empty /template/ ToggleButton#PART_ExpandCollapseChevron">
|
||||
<Setter Property="Opacity" Value="0" />
|
||||
<Setter Property="IsHitTestVisible" Value="False" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -33,6 +33,7 @@
|
||||
<ResourceInclude Source="TagInput.axaml" />
|
||||
<ResourceInclude Source="ThemeSelector.axaml" />
|
||||
<ResourceInclude Source="Timeline.axaml" />
|
||||
<ResourceInclude Source="TreeComboBox.axaml"/>
|
||||
<ResourceInclude Source="Skeleton.axaml" />
|
||||
<ResourceInclude Source="TwoTonePathIcon.axaml" />
|
||||
<ResourceInclude Source="ToolBar.axaml" />
|
||||
|
||||
Reference in New Issue
Block a user