fix: fix an empty selection handling.
This commit is contained in:
@@ -1570,7 +1570,7 @@ public partial class MultiAutoCompleteBox : TemplatedControl, IInnerContentContr
|
|||||||
private void OnAdapterSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
private void OnAdapterSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_valueBindingEvaluator is null) return;
|
if (_valueBindingEvaluator is null) return;
|
||||||
UpdateTextValue(_valueBindingEvaluator?.GetDynamicValue(_adapter?.SelectedItem), false);
|
UpdateTextValue(_valueBindingEvaluator?.GetDynamicValue(_adapter?.SelectedItem, true), false);
|
||||||
// SelectedItems?.Add(_adapter?.SelectedItem);
|
// SelectedItems?.Add(_adapter?.SelectedItem);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1588,6 +1588,7 @@ public partial class MultiAutoCompleteBox : TemplatedControl, IInnerContentContr
|
|||||||
// Completion will update the selected value
|
// Completion will update the selected value
|
||||||
//UpdateTextCompletion(false);
|
//UpdateTextCompletion(false);
|
||||||
_ = SelectedItems ?? throw new NullReferenceException("Selected Items collection must be initialized. ");
|
_ = SelectedItems ?? throw new NullReferenceException("Selected Items collection must be initialized. ");
|
||||||
|
if (_adapter?.SelectedItem is null) return;
|
||||||
SelectedItems?.Add(_adapter?.SelectedItem);
|
SelectedItems?.Add(_adapter?.SelectedItem);
|
||||||
UpdateTextValue(string.Empty, false);
|
UpdateTextValue(string.Empty, false);
|
||||||
|
|
||||||
@@ -1842,7 +1843,7 @@ public partial class MultiAutoCompleteBox : TemplatedControl, IInnerContentContr
|
|||||||
/// context leaf node.
|
/// context leaf node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of dynamic binding to return.</typeparam>
|
/// <typeparam name="T">The type of dynamic binding to return.</typeparam>
|
||||||
public class BindingEvaluator<T> : Control
|
public class BindingEvaluator<T> : StyledElement
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifies the Value dependency property.
|
/// Identifies the Value dependency property.
|
||||||
@@ -1920,7 +1921,7 @@ public partial class MultiAutoCompleteBox : TemplatedControl, IInnerContentContr
|
|||||||
/// Returns the evaluated T value of the bound dependency
|
/// Returns the evaluated T value of the bound dependency
|
||||||
/// property.
|
/// property.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public T GetDynamicValue(object o, bool clearDataContext)
|
public T GetDynamicValue(object? o, bool clearDataContext)
|
||||||
{
|
{
|
||||||
DataContext = o;
|
DataContext = o;
|
||||||
var value = Value;
|
var value = Value;
|
||||||
|
|||||||
Reference in New Issue
Block a user