From 5c11cef2088b7379662f51801888b913c6a3f918 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sun, 11 Oct 2020 14:52:04 +0800 Subject: [PATCH] Update CheckComboBox.cs --- .../Input/CheckComboBox/CheckComboBox.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBox.cs b/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBox.cs index ab4414537..169a3e698 100644 --- a/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBox.cs +++ b/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBox.cs @@ -2,8 +2,10 @@ using System.ComponentModel; using System.Windows; using System.Windows.Controls; +using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Input; +using System.Windows.Threading; using HandyControl.Data; using HandyControl.Interactivity; @@ -102,6 +104,15 @@ public CheckComboBox() { AddHandler(Controls.Tag.ClosedEvent, new RoutedEventHandler(Tags_OnClosed)); CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) => SelectedItems.Clear())); + ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged; + } + + private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e) + { + if (ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated) + { + UpdateTags(); + } } public override void OnApplyTemplate() @@ -121,6 +132,12 @@ public override void OnApplyTemplate() _selectAllItem.Selected += SelectAllItem_Selected; _selectAllItem.Unselected += SelectAllItem_Unselected; } + + Dispatcher.BeginInvoke(new Action(() => + { + IsDropDownOpen = true; + IsDropDownOpen = false; + }), DispatcherPriority.DataBind); } public bool VerifyData()