feat: add CornerRadius property to MultiAutoCompleteBox and improve focus handling logic
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<ControlTheme x:Key="{x:Type u:MultiAutoCompleteBox}" TargetType="u:MultiAutoCompleteBox">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxDefaultHeight}" />
|
||||
<Setter Property="MaxDropDownHeight" Value="{DynamicResource AutoCompleteMaxDropdownHeight}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}"></Setter>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:MultiAutoCompleteBox">
|
||||
<Panel>
|
||||
@@ -13,10 +14,12 @@
|
||||
MinHeight="30"
|
||||
Padding="{DynamicResource TextBoxContentPadding}"
|
||||
VerticalAlignment="Stretch"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Background="{DynamicResource TextBoxDefaultBackground}"
|
||||
BorderBrush="{DynamicResource TextBoxDefaultBorderBrush}">
|
||||
<ItemsControl
|
||||
Name="{x:Static u:MultiAutoCompleteBox.PART_SelectedItemsControl}"
|
||||
VerticalAlignment="Center"
|
||||
ItemsSource="{TemplateBinding SelectedItems}" >
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@@ -536,14 +536,11 @@ public partial class MultiAutoCompleteBox : TemplatedControl, IInnerContentContr
|
||||
if (selector != null)
|
||||
{
|
||||
// Check if it is already an IItemsSelector
|
||||
adapter = selector as ISelectionAdapter;
|
||||
if (adapter == null)
|
||||
// Built in support for wrapping a Selector control
|
||||
adapter = new MultiAutoCompleteSelectionAdapter(selector);
|
||||
// Built in support for wrapping a Selector control
|
||||
adapter = new MultiAutoCompleteSelectionAdapter(selector);
|
||||
}
|
||||
|
||||
if (adapter == null) adapter = nameScope.Find<ISelectionAdapter>(ElementSelectionAdapter);
|
||||
return adapter;
|
||||
return adapter ?? nameScope.Find<ISelectionAdapter>(ElementSelectionAdapter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -745,8 +742,7 @@ public partial class MultiAutoCompleteBox : TemplatedControl, IInnerContentContr
|
||||
// Check if we still have focus in the parent's focus scope
|
||||
if (GetFocusScope() is { } scope &&
|
||||
(TopLevel.GetTopLevel(this)?.FocusManager?.GetFocusedElement() is not { } focused ||
|
||||
(focused != this &&
|
||||
focused is Visual v && !this.IsVisualAncestorOf(v))))
|
||||
(focused != this && focused is not ListBoxItem && focused is Visual v && !this.IsVisualAncestorOf(v))))
|
||||
SetCurrentValue(IsDropDownOpenProperty, false);
|
||||
|
||||
_userCalledPopulate = false;
|
||||
|
||||
Reference in New Issue
Block a user