@@ -67,4 +67,7 @@
|
||||
<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
|
||||
</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>
|
||||
@@ -22,12 +22,13 @@
|
||||
Watermark="{TemplateBinding Watermark}" />
|
||||
<Popup
|
||||
Name="PART_Popup"
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
IsLightDismissEnabled="True"
|
||||
PlacementTarget="{TemplateBinding}">
|
||||
<Border
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
||||
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
||||
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
||||
|
||||
@@ -2,7 +2,16 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
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">
|
||||
<Setter Property="Focusable" Value="True" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
@@ -10,7 +19,7 @@
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource ComboBoxSelectorCornerRadius}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorBorderBrush}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="MaxDropdownHeight" Value="300" />
|
||||
<Setter Property="MaxDropDownHeight" Value="300" />
|
||||
<Setter Property="MaxSelectionBoxHeight" Value="270" />
|
||||
<Setter Property="MinHeight" Value="32" />
|
||||
<Setter Property="Padding" Value="12 4" />
|
||||
@@ -42,18 +51,18 @@
|
||||
IsVisible="{TemplateBinding InnerLeftContent,
|
||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||
<TextBlock
|
||||
x:Name="PlaceholderTextBlock"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsHitTestVisible="False"
|
||||
IsVisible="False"
|
||||
Opacity="0.3"
|
||||
Text="{TemplateBinding Watermark}" />
|
||||
x:Name="PlaceholderTextBlock"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsHitTestVisible="False"
|
||||
IsVisible="False"
|
||||
Opacity="0.3"
|
||||
Text="{TemplateBinding Watermark}" />
|
||||
<ScrollViewer
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
@@ -102,22 +111,23 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
<Popup
|
||||
MinWidth="{Binding #PART_RootGrid.Bounds.Width}"
|
||||
MaxHeight="{TemplateBinding MaxDropdownHeight}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
IsLightDismissEnabled="True"
|
||||
IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen, Mode=TwoWay}"
|
||||
PlacementTarget="PART_RootGrid">
|
||||
<Border
|
||||
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
||||
HorizontalAlignment="Stretch"
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
||||
Padding="{DynamicResource ComboBoxPopupBorderPadding}"
|
||||
Background="{DynamicResource ComboBoxPopupBackground}"
|
||||
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
||||
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
||||
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
||||
CornerRadius="6">
|
||||
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}">
|
||||
<DockPanel LastChildFill="True">
|
||||
<ContentPresenter Content="{TemplateBinding PopupInnerTopContent}" DockPanel.Dock="Top"/>
|
||||
<ContentPresenter Content="{TemplateBinding PopupInnerBottomContent}" DockPanel.Dock="Bottom"/>
|
||||
<ContentPresenter Content="{TemplateBinding PopupInnerTopContent}" DockPanel.Dock="Top" />
|
||||
<ContentPresenter Content="{TemplateBinding PopupInnerBottomContent}" DockPanel.Dock="Bottom" />
|
||||
<ScrollViewer
|
||||
Grid.IsSharedSizeScope="True"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
@@ -208,7 +218,7 @@
|
||||
</ControlTheme>
|
||||
|
||||
<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="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
@@ -220,6 +230,7 @@
|
||||
<ControlTemplate TargetType="u:MultiComboBoxItem">
|
||||
<Border
|
||||
x:Name="RootBorder"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -231,20 +242,18 @@
|
||||
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
||||
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
||||
Theme="{DynamicResource InnerPathIcon}"
|
||||
Margin="8,0"
|
||||
Margin="0 0 8 0"
|
||||
VerticalAlignment="Center"
|
||||
Data="{DynamicResource CheckBoxCheckGlyph}"
|
||||
Data="{DynamicResource SemiIconTick}"
|
||||
Opacity="0" />
|
||||
<ContentPresenter
|
||||
x:Name="ContentPresenter"
|
||||
Grid.Column="1"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
IsVisible="{TemplateBinding Content,
|
||||
Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
RecognizesAccessKey="True"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
|
||||
@@ -5,7 +5,20 @@
|
||||
xmlns:converters1="clr-namespace:Ursa.Converters;assembly=Ursa"
|
||||
xmlns:iri="https://irihi.tech/shared"
|
||||
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
|
||||
x:Key="LeftMarginConverter"
|
||||
@@ -100,7 +113,6 @@
|
||||
<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"
|
||||
@@ -110,12 +122,14 @@
|
||||
WindowManagerAddShadowHint="False">
|
||||
<Border
|
||||
Name="PopupBorder"
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
||||
Padding="{DynamicResource ComboBoxPopupBorderPadding}"
|
||||
Background="{DynamicResource ComboBoxPopupBackground}"
|
||||
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
||||
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
||||
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
||||
CornerRadius="6">
|
||||
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}">
|
||||
<DockPanel LastChildFill="True">
|
||||
<ContentPresenter
|
||||
Name="PART_PopupHeader"
|
||||
|
||||
@@ -30,9 +30,9 @@ public class MultiComboBox : SelectingItemsControl, IInnerContentControl, IPopup
|
||||
public static readonly StyledProperty<bool> IsDropDownOpenProperty =
|
||||
ComboBox.IsDropDownOpenProperty.AddOwner<MultiComboBox>();
|
||||
|
||||
public static readonly StyledProperty<double> MaxDropdownHeightProperty =
|
||||
public static readonly StyledProperty<double> MaxDropDownHeightProperty =
|
||||
AvaloniaProperty.Register<MultiComboBox, double>(
|
||||
nameof(MaxDropdownHeight));
|
||||
nameof(MaxDropDownHeight));
|
||||
|
||||
public static readonly StyledProperty<double> MaxSelectionBoxHeightProperty =
|
||||
AvaloniaProperty.Register<MultiComboBox, double>(
|
||||
@@ -89,10 +89,10 @@ public class MultiComboBox : SelectingItemsControl, IInnerContentControl, IPopup
|
||||
set => SetValue(IsDropDownOpenProperty, value);
|
||||
}
|
||||
|
||||
public double MaxDropdownHeight
|
||||
public double MaxDropDownHeight
|
||||
{
|
||||
get => GetValue(MaxDropdownHeightProperty);
|
||||
set => SetValue(MaxDropdownHeightProperty, value);
|
||||
get => GetValue(MaxDropDownHeightProperty);
|
||||
set => SetValue(MaxDropDownHeightProperty, value);
|
||||
}
|
||||
|
||||
public double MaxSelectionBoxHeight
|
||||
|
||||
Reference in New Issue
Block a user