@@ -67,4 +67,7 @@
|
|||||||
<StreamGeometry x:Key="SemiIconMoon">
|
<StreamGeometry x:Key="SemiIconMoon">
|
||||||
M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm5-8c.48 0 .94-.05 1.39-.14a7 7 0 1 1-7.78-9.72A7 7 0 0 0 17 15Z
|
M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm5-8c.48 0 .94-.05 1.39-.14a7 7 0 1 1-7.78-9.72A7 7 0 0 0 17 15Z
|
||||||
</StreamGeometry>
|
</StreamGeometry>
|
||||||
|
<StreamGeometry x:Key="SemiIconTick">
|
||||||
|
M21.35 4.27c.68.47.86 1.4.38 2.08l-10 14.5a1.5 1.5 0 0 1-2.33.17l-6.5-7a1.5 1.5 0 0 1 2.2-2.04l5.23 5.63 8.94-12.96a1.5 1.5 0 0 1 2.08-.38Z
|
||||||
|
</StreamGeometry>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -22,12 +22,13 @@
|
|||||||
Watermark="{TemplateBinding Watermark}" />
|
Watermark="{TemplateBinding Watermark}" />
|
||||||
<Popup
|
<Popup
|
||||||
Name="PART_Popup"
|
Name="PART_Popup"
|
||||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
|
||||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
PlacementTarget="{TemplateBinding}">
|
PlacementTarget="{TemplateBinding}">
|
||||||
<Border
|
<Border
|
||||||
|
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
||||||
|
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
||||||
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
||||||
|
|||||||
@@ -2,7 +2,16 @@
|
|||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:u="https://irihi.tech/ursa">
|
xmlns:u="https://irihi.tech/ursa">
|
||||||
<!-- Add Resources Here -->
|
<Design.PreviewWith>
|
||||||
|
<StackPanel Height="300">
|
||||||
|
<u:MultiComboBox Width="300">
|
||||||
|
<u:MultiComboBoxItem Content="Option 1" />
|
||||||
|
<u:MultiComboBoxItem Content="Option 2" />
|
||||||
|
<u:MultiComboBoxItem Content="Option 3" />
|
||||||
|
<u:MultiComboBoxItem Content="Option 4" />
|
||||||
|
</u:MultiComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
</Design.PreviewWith>
|
||||||
<ControlTheme x:Key="{x:Type u:MultiComboBox}" TargetType="u:MultiComboBox">
|
<ControlTheme x:Key="{x:Type u:MultiComboBox}" TargetType="u:MultiComboBox">
|
||||||
<Setter Property="Focusable" Value="True" />
|
<Setter Property="Focusable" Value="True" />
|
||||||
<Setter Property="VerticalAlignment" Value="Top" />
|
<Setter Property="VerticalAlignment" Value="Top" />
|
||||||
@@ -10,7 +19,7 @@
|
|||||||
<Setter Property="CornerRadius" Value="{DynamicResource ComboBoxSelectorCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ComboBoxSelectorCornerRadius}" />
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorBorderBrush}" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
<Setter Property="MaxDropdownHeight" Value="300" />
|
<Setter Property="MaxDropDownHeight" Value="300" />
|
||||||
<Setter Property="MaxSelectionBoxHeight" Value="270" />
|
<Setter Property="MaxSelectionBoxHeight" Value="270" />
|
||||||
<Setter Property="MinHeight" Value="32" />
|
<Setter Property="MinHeight" Value="32" />
|
||||||
<Setter Property="Padding" Value="12 4" />
|
<Setter Property="Padding" Value="12 4" />
|
||||||
@@ -42,18 +51,18 @@
|
|||||||
IsVisible="{TemplateBinding InnerLeftContent,
|
IsVisible="{TemplateBinding InnerLeftContent,
|
||||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="PlaceholderTextBlock"
|
x:Name="PlaceholderTextBlock"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
Margin="{TemplateBinding Padding}"
|
Margin="{TemplateBinding Padding}"
|
||||||
TextTrimming="CharacterEllipsis"
|
TextTrimming="CharacterEllipsis"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
Opacity="0.3"
|
Opacity="0.3"
|
||||||
Text="{TemplateBinding Watermark}" />
|
Text="{TemplateBinding Watermark}" />
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
@@ -102,22 +111,23 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<Popup
|
<Popup
|
||||||
MinWidth="{Binding #PART_RootGrid.Bounds.Width}"
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||||
MaxHeight="{TemplateBinding MaxDropdownHeight}"
|
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen, Mode=TwoWay}"
|
IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen, Mode=TwoWay}"
|
||||||
PlacementTarget="PART_RootGrid">
|
PlacementTarget="PART_RootGrid">
|
||||||
<Border
|
<Border
|
||||||
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
|
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
||||||
|
Padding="{DynamicResource ComboBoxPopupBorderPadding}"
|
||||||
Background="{DynamicResource ComboBoxPopupBackground}"
|
Background="{DynamicResource ComboBoxPopupBackground}"
|
||||||
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
||||||
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
||||||
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
||||||
CornerRadius="6">
|
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}">
|
||||||
<DockPanel LastChildFill="True">
|
<DockPanel LastChildFill="True">
|
||||||
<ContentPresenter Content="{TemplateBinding PopupInnerTopContent}" DockPanel.Dock="Top"/>
|
<ContentPresenter Content="{TemplateBinding PopupInnerTopContent}" DockPanel.Dock="Top" />
|
||||||
<ContentPresenter Content="{TemplateBinding PopupInnerBottomContent}" DockPanel.Dock="Bottom"/>
|
<ContentPresenter Content="{TemplateBinding PopupInnerBottomContent}" DockPanel.Dock="Bottom" />
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Grid.IsSharedSizeScope="True"
|
Grid.IsSharedSizeScope="True"
|
||||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||||
@@ -208,7 +218,7 @@
|
|||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type u:MultiComboBoxItem}" TargetType="u:MultiComboBoxItem">
|
<ControlTheme x:Key="{x:Type u:MultiComboBoxItem}" TargetType="u:MultiComboBoxItem">
|
||||||
<Setter Property="Padding" Value="8,0,0,0" />
|
<Setter Property="Padding" Value="12 8" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||||
<Setter Property="VerticalAlignment" Value="Top" />
|
<Setter Property="VerticalAlignment" Value="Top" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
@@ -220,6 +230,7 @@
|
|||||||
<ControlTemplate TargetType="u:MultiComboBoxItem">
|
<ControlTemplate TargetType="u:MultiComboBoxItem">
|
||||||
<Border
|
<Border
|
||||||
x:Name="RootBorder"
|
x:Name="RootBorder"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
@@ -231,20 +242,18 @@
|
|||||||
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
||||||
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
||||||
Theme="{DynamicResource InnerPathIcon}"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Margin="8,0"
|
Margin="0 0 8 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Data="{DynamicResource CheckBoxCheckGlyph}"
|
Data="{DynamicResource SemiIconTick}"
|
||||||
Opacity="0" />
|
Opacity="0" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
x:Name="ContentPresenter"
|
x:Name="ContentPresenter"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="{TemplateBinding Padding}"
|
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Content="{TemplateBinding Content}"
|
Content="{TemplateBinding Content}"
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
IsVisible="{TemplateBinding Content,
|
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||||
Converter={x:Static ObjectConverters.IsNotNull}}"
|
|
||||||
RecognizesAccessKey="True"
|
RecognizesAccessKey="True"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -5,7 +5,20 @@
|
|||||||
xmlns:converters1="clr-namespace:Ursa.Converters;assembly=Ursa"
|
xmlns:converters1="clr-namespace:Ursa.Converters;assembly=Ursa"
|
||||||
xmlns:iri="https://irihi.tech/shared"
|
xmlns:iri="https://irihi.tech/shared"
|
||||||
xmlns:u="https://irihi.tech/ursa">
|
xmlns:u="https://irihi.tech/ursa">
|
||||||
<!-- Add Resources Here -->
|
<Design.PreviewWith>
|
||||||
|
<StackPanel Height="300">
|
||||||
|
<u:TreeComboBox
|
||||||
|
Watermark="Please Select"
|
||||||
|
Width="300"
|
||||||
|
MaxHeight="200">
|
||||||
|
<u:TreeComboBoxItem Header="Option 1">
|
||||||
|
<u:TreeComboBoxItem Header="Inner Option 1" />
|
||||||
|
<u:TreeComboBoxItem Header="Inner Option 2" />
|
||||||
|
</u:TreeComboBoxItem>
|
||||||
|
<u:TreeComboBoxItem Header="Option 2" />
|
||||||
|
</u:TreeComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
</Design.PreviewWith>
|
||||||
|
|
||||||
<converters:MarginMultiplierConverter
|
<converters:MarginMultiplierConverter
|
||||||
x:Key="LeftMarginConverter"
|
x:Key="LeftMarginConverter"
|
||||||
@@ -100,7 +113,6 @@
|
|||||||
<Popup
|
<Popup
|
||||||
Name="{x:Static iri:PartNames.PART_Popup}"
|
Name="{x:Static iri:PartNames.PART_Popup}"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
|
||||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||||
ClipToBounds="False"
|
ClipToBounds="False"
|
||||||
InheritsTransform="True"
|
InheritsTransform="True"
|
||||||
@@ -110,12 +122,14 @@
|
|||||||
WindowManagerAddShadowHint="False">
|
WindowManagerAddShadowHint="False">
|
||||||
<Border
|
<Border
|
||||||
Name="PopupBorder"
|
Name="PopupBorder"
|
||||||
|
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
||||||
|
Padding="{DynamicResource ComboBoxPopupBorderPadding}"
|
||||||
Background="{DynamicResource ComboBoxPopupBackground}"
|
Background="{DynamicResource ComboBoxPopupBackground}"
|
||||||
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
||||||
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
||||||
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
||||||
CornerRadius="6">
|
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}">
|
||||||
<DockPanel LastChildFill="True">
|
<DockPanel LastChildFill="True">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_PopupHeader"
|
Name="PART_PopupHeader"
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ public class MultiComboBox : SelectingItemsControl, IInnerContentControl, IPopup
|
|||||||
public static readonly StyledProperty<bool> IsDropDownOpenProperty =
|
public static readonly StyledProperty<bool> IsDropDownOpenProperty =
|
||||||
ComboBox.IsDropDownOpenProperty.AddOwner<MultiComboBox>();
|
ComboBox.IsDropDownOpenProperty.AddOwner<MultiComboBox>();
|
||||||
|
|
||||||
public static readonly StyledProperty<double> MaxDropdownHeightProperty =
|
public static readonly StyledProperty<double> MaxDropDownHeightProperty =
|
||||||
AvaloniaProperty.Register<MultiComboBox, double>(
|
AvaloniaProperty.Register<MultiComboBox, double>(
|
||||||
nameof(MaxDropdownHeight));
|
nameof(MaxDropDownHeight));
|
||||||
|
|
||||||
public static readonly StyledProperty<double> MaxSelectionBoxHeightProperty =
|
public static readonly StyledProperty<double> MaxSelectionBoxHeightProperty =
|
||||||
AvaloniaProperty.Register<MultiComboBox, double>(
|
AvaloniaProperty.Register<MultiComboBox, double>(
|
||||||
@@ -89,10 +89,10 @@ public class MultiComboBox : SelectingItemsControl, IInnerContentControl, IPopup
|
|||||||
set => SetValue(IsDropDownOpenProperty, value);
|
set => SetValue(IsDropDownOpenProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double MaxDropdownHeight
|
public double MaxDropDownHeight
|
||||||
{
|
{
|
||||||
get => GetValue(MaxDropdownHeightProperty);
|
get => GetValue(MaxDropDownHeightProperty);
|
||||||
set => SetValue(MaxDropdownHeightProperty, value);
|
set => SetValue(MaxDropDownHeightProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double MaxSelectionBoxHeight
|
public double MaxSelectionBoxHeight
|
||||||
|
|||||||
Reference in New Issue
Block a user