private void CustomScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { if (e.Source is CustomScrollLayout && Math.Abs(e.VerticalChange) > 0) { CustomNotificationMessenger.Send(NotificationMessageToken.CloseComboBoxItemArea); } }
public CustomComboBox() { Loaded += (sender, e) => { //设置DisplayMemberPath、SelectedValuePath DisplayMemberPath = CustomDisplayMemberPath; SelectedValuePath = CustomSelectedValuePath; //设置值为默认双向绑定 SetBindingModeToTwoWay(); CustomNotificationMessenger.Register <string>(this, NotificationMessageToken.CloseComboBoxItemArea, message => { //页面滚动条滚动时自动关闭打开的ComboBox下拉项 IsDropDownOpen = false; }); }; Unloaded += (sender, e) => { CustomNotificationMessenger.Unregister <string>(this); }; SelectionChanged += CustomComboBox_SelectionChanged; }
protected void UnregisterMessages() { CustomNotificationMessenger.Unregister <string>(this); }
protected void RegisterMessages() { CustomNotificationMessenger.Register <string>(this, NotificationMessageToken.CancelCustomerConfigView, message => Close()); }