* UIPagination:增加DataSource切换事件,TotalCount总数,PageCount总页数,ActivePage选中页码

This commit is contained in:
Sunny 2020-07-29 20:39:30 +08:00
parent fc65d3a5cb
commit 1401d26d43
5 changed files with 21 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -75,9 +75,21 @@ namespace Sunny.UI
public UIPieSeriesLabel Label = new UIPieSeriesLabel();
public delegate Color OnDataColorChangeEventHandler(double data);
public event OnDataColorChangeEventHandler DataColorChange;
public void AddData(string name, double value)
{
Data.Add(new UIPieSeriesData(name, value));
if (DataColorChange != null)
{
Color color = DataColorChange.Invoke(value);
Data.Add(new UIPieSeriesData(name, value,color));
}
else
{
Data.Add(new UIPieSeriesData(name, value));
}
}
public void AddData(string name, double value, Color color)

View File

@ -65,7 +65,11 @@ namespace Sunny.UI
private bool inSetDataConnection;
private UIPanel p1;
private int PageCount;
/// <summary>
/// 总页数
/// </summary>
[Browsable(false)]
public int PageCount { get; private set; }
private int pagerCount = 7;
@ -215,6 +219,8 @@ namespace Sunny.UI
set => p1.Visible = value;
}
public event EventHandler DataSourceChanged;
[DefaultValue(null)]
[RefreshProperties(RefreshProperties.Repaint)]
[AttributeProvider(typeof(IListSource))]
@ -235,6 +241,7 @@ namespace Sunny.UI
dataSource = value;
activePage = 1;
TotalCount = dataManager?.List.Count ?? 0;
DataSourceChanged?.Invoke(this,null);
}
}