forked from lt8300877/NormalizingApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlBinding.cs
More file actions
69 lines (66 loc) · 1.72 KB
/
ControlBinding.cs
File metadata and controls
69 lines (66 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NormalizingApp.Lib
{
/// <summary>
/// 仪表盘控件的事件绑定
/// </summary>
public class MyGauge : INotifyPropertyChanged //绑定对象
{
private double _score;//显示
public event PropertyChangedEventHandler PropertyChanged;
public double Score
{
get { return this._score; }
set
{
this._score = value;
if (PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs("Score"));
}
}
}
public MyGauge(double scr)
{
this.Score = scr;
}
public MyGauge() { }
}
/// <summary>
/// TextBlock数据绑定
/// </summary>
public class DataDisplay : INotifyPropertyChanged
{
private string _DataText;
public string DataText
{
get { return _DataText; }
set
{
if (value != _DataText)
{
_DataText = value;
Notify("DataText");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void Notify(string propertyName)
{
if (PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public DataDisplay(string s)
{
this._DataText = s;
}
public DataDisplay() { }
}
}