| 1 | using System; |
| 2 | using System.Collections.Generic; |
| 3 | using System.Linq; |
| 4 | using System.Text; |
| 5 | using System.Threading.Tasks; |
| 6 | using System.Windows; |
| 7 | using System.Windows.Controls; |
| 8 | |
| 9 | namespace UI.Controls.Select |
| 10 | { |
| 11 | public class Option : Control |
| 12 | { |
| 13 | public bool IsShowIcon |
| 14 | { |
| 15 | get { return (bool)GetValue(IsShowIconProperty); } |
| 16 | set { SetValue(IsShowIconProperty, value); } |
| 17 | } |
| 18 | public static readonly DependencyProperty IsShowIconProperty = |
| 19 | DependencyProperty.Register("IsShowIcon", |
| 20 | typeof(bool), |
| 21 | typeof(Option), new PropertyMetadata(true)); |
| 22 | public bool IsChecked |
| 23 | { |
| 24 | get { return (bool)GetValue(IsCheckedProperty); } |
| 25 | set { SetValue(IsCheckedProperty, value); } |
| 26 | } |
| 27 | public static readonly DependencyProperty IsCheckedProperty = |
| 28 | DependencyProperty.Register("IsChecked", |
| 29 | typeof(bool), |
| 30 | typeof(Option), new PropertyMetadata(false)); |
| 31 | |
| 32 | public SelectItemModel Value |
| 33 | { |
| 34 | get { return (SelectItemModel)GetValue(ValueProperty); } |
| 35 | set { SetValue(ValueProperty, value); } |
| 36 | } |
| 37 | public static readonly DependencyProperty ValueProperty = |
| 38 | DependencyProperty.Register("Value", |
| 39 | typeof(SelectItemModel), |
| 40 | typeof(Option)); |
| 41 | public Option() |
| 42 | { |
| 43 | DefaultStyleKey = typeof(Option); |
| 44 | |
| 45 | MouseLeftButtonUp += Option_MouseLeftButtonUp; |
| 46 | } |
| 47 | |
| 48 | private void Option_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) |
| 49 | { |
| 50 | IsChecked = !IsChecked; |
| 51 | } |
| 52 | } |
| 53 | } |