CheckComboBoxItem.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using System.Windows.Input;
  4. namespace CustomUI
  5. {
  6. public class CheckComboBoxItem : ListBoxItem
  7. {
  8. #region private fields
  9. private CheckComboBox ParentCheckComboBox
  10. {
  11. get
  12. {
  13. return ItemsControl.ItemsControlFromItemContainer(this) as CheckComboBox;
  14. }
  15. }
  16. #endregion
  17. #region DependencyProperty
  18. #endregion
  19. #region Constructors
  20. static CheckComboBoxItem()
  21. {
  22. DefaultStyleKeyProperty.OverrideMetadata(typeof(CheckComboBoxItem), new FrameworkPropertyMetadata(typeof(CheckComboBoxItem)));
  23. }
  24. #endregion
  25. #region Override
  26. public override void OnApplyTemplate()
  27. {
  28. base.OnApplyTemplate();
  29. }
  30. protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
  31. {
  32. if(this.ParentCheckComboBox != null)
  33. {
  34. this.ParentCheckComboBox.NotifyCheckComboBoxItemClicked(this);
  35. }
  36. base.OnMouseLeftButtonDown(e);
  37. }
  38. #endregion
  39. #region private function
  40. #endregion
  41. #region Event Implement Function
  42. #endregion
  43. }
  44. }