|
|
@@ -126,26 +126,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls |
|
|
|
} |
|
|
|
public static readonly DependencyProperty CodeProperty = |
|
|
|
DependencyProperty.Register("Code", typeof(string), typeof(TheListBox), new PropertyMetadata(_code)); |
|
|
|
//[Category("数据绑定")] |
|
|
|
//public bool IsRun |
|
|
|
//{ |
|
|
|
// get { return (bool)GetValue(RunProperty); } |
|
|
|
// set { SetValue(RunProperty, value); } |
|
|
|
//} |
|
|
|
//public static readonly DependencyProperty RunProperty = |
|
|
|
// DependencyProperty.Register("IsRun", typeof(bool), typeof(TheListBox), new PropertyMetadata(false, new PropertyChangedCallback(onIsRunChanged))); |
|
|
|
//private static void onIsRunChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as TheListBox)?.IsRunRefresh(); |
|
|
|
public void IsRunRefresh() |
|
|
|
{ |
|
|
|
////测试运行 |
|
|
|
//if (IsRun) |
|
|
|
// IsExecuteState = true; |
|
|
|
//else |
|
|
|
//{ |
|
|
|
// IsExecuteState = false; |
|
|
|
// Dispose(); |
|
|
|
//} |
|
|
|
} |
|
|
|
[Category("数据绑定")] |
|
|
|
public string GenerateData |
|
|
|
{ |
|
|
@@ -163,18 +143,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls |
|
|
|
{ |
|
|
|
Dictionary<string, object> keys = JsonConvert.DeserializeObject<Dictionary<string, object>>(GenerateData); |
|
|
|
ItemsString = JsonConvert.DeserializeObject<ObservableCollection<object>>(keys["data"].ToString()); |
|
|
|
|
|
|
|
|
|
|
|
//ItemsString = JsonConvert.DeserializeObject<DataSouceModel>(GenerateData); |
|
|
|
// 运行时进行项目绑定 |
|
|
|
|
|
|
|
//this.ItemsSource = ListToDataTable(obj2).DefaultView; |
|
|
|
|
|
|
|
// 运行时进行项目绑定 |
|
|
|
//Binding binding = new Binding(); |
|
|
|
//binding.RelativeSource = new RelativeSource() { Mode = RelativeSourceMode.Self }; |
|
|
|
//binding.Path = new PropertyPath("ItemsString"); |
|
|
|
//SetBinding(ItemsSourceProperty,binding); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
@@ -250,22 +218,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls |
|
|
|
|
|
|
|
public void XmlToFrameworkElement() |
|
|
|
{ |
|
|
|
StackPanel stackPanel = new StackPanel() { Width = 600, Height = 30, Orientation = Orientation.Horizontal }; |
|
|
|
Button button = new Button(); |
|
|
|
button.Name = "button1"; |
|
|
|
Binding bindingButton = new Binding("alarmTime"); |
|
|
|
button.SetBinding(Button.ContentProperty, bindingButton); |
|
|
|
stackPanel.Children.Add(button); |
|
|
|
|
|
|
|
TextBlock textBlock = new TextBlock(); |
|
|
|
textBlock.Name = "text1"; |
|
|
|
Binding bindingtextBlock = new Binding("alarmMessage"); |
|
|
|
textBlock.SetBinding(TextBlock.TextProperty, bindingtextBlock); |
|
|
|
stackPanel.Children.Add(textBlock); |
|
|
|
FrameworkElementToXml(stackPanel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var template = (DataTemplate)XamlReader.Parse(@" |
|
|
|
<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" |
|
|
|
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""> |
|
|
@@ -283,7 +235,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls |
|
|
|
{ |
|
|
|
timer.Stop(); |
|
|
|
FDataSouce = ""; |
|
|
|
//if (IsRun) IsRun = false; |
|
|
|
GenerateDataRefresh(); |
|
|
|
} |
|
|
|
|
|
|
|