跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

浏览文件

BaseListItem.cs

40 行 · 1.6 KB历史下载
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using System.Windows;
7using System.Windows.Controls;
8using System.Windows.Input;
9
10namespace 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 //public Command RemoveCommand { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } }
21 //public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(BaseListItem));
22
23 //public event EventHandler ItemChanged;
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}