| 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 | using System.Windows.Input; |
| 9 | |
| 10 | namespace UI.Controls.List |
| 11 | { |
| 12 | public class BaseListItem : Control |
| 13 | { |
| 14 | public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } |
| 15 | public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(BaseListItem)); |
| 16 | |
| 17 | public bool IsSelected { get { return (bool)GetValue(IsSelectedProperty); } set { SetValue(IsSelectedProperty, value); } } |
| 18 | public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register("IsSelected", typeof(bool), typeof(BaseListItem)); |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | public BaseListItem() |
| 26 | { |
| 27 | DefaultStyleKey = typeof(BaseListItem); |
| 28 | } |
| 29 | protected override void OnMouseEnter(MouseEventArgs e) |
| 30 | { |
| 31 | base.OnMouseEnter(e); |
| 32 | VisualStateManager.GoToState(this, "MouseOver", true); |
| 33 | } |
| 34 | protected override void OnMouseLeave(MouseEventArgs e) |
| 35 | { |
| 36 | base.OnMouseLeave(e); |
| 37 | VisualStateManager.GoToState(this, "Normal", true); |
| 38 | } |
| 39 | } |
| 40 | } |