本文整理汇总了C#中TreeView.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.SetBinding方法的具体用法?C# TreeView.SetBinding怎么用?C# TreeView.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeView
的用法示例。
在下文中一共展示了TreeView.SetBinding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get_TabControl_Items
private static System.Collections.ObjectModel.ObservableCollection<object> Get_TabControl_Items()
{
System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
// e_3 element
TabItem e_3 = new TabItem();
e_3.Name = "e_3";
e_3.HorizontalContentAlignment = HorizontalAlignment.Stretch;
e_3.Header = "Controls";
// e_4 element
Grid e_4 = new Grid();
e_3.Content = e_4;
e_4.Name = "e_4";
RowDefinition row_e_4_0 = new RowDefinition();
row_e_4_0.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_0);
RowDefinition row_e_4_1 = new RowDefinition();
row_e_4_1.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_1);
RowDefinition row_e_4_2 = new RowDefinition();
row_e_4_2.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_2);
RowDefinition row_e_4_3 = new RowDefinition();
row_e_4_3.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_3);
RowDefinition row_e_4_4 = new RowDefinition();
row_e_4_4.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_4);
RowDefinition row_e_4_5 = new RowDefinition();
row_e_4_5.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_5);
RowDefinition row_e_4_6 = new RowDefinition();
row_e_4_6.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_6);
RowDefinition row_e_4_7 = new RowDefinition();
row_e_4_7.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_7);
RowDefinition row_e_4_8 = new RowDefinition();
row_e_4_8.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_8);
RowDefinition row_e_4_9 = new RowDefinition();
row_e_4_9.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_9);
ColumnDefinition col_e_4_0 = new ColumnDefinition();
col_e_4_0.Width = new GridLength(1F, GridUnitType.Auto);
e_4.ColumnDefinitions.Add(col_e_4_0);
ColumnDefinition col_e_4_1 = new ColumnDefinition();
e_4.ColumnDefinitions.Add(col_e_4_1);
// e_5 element
TextBlock e_5 = new TextBlock();
e_4.Children.Add(e_5);
e_5.Name = "e_5";
e_5.VerticalAlignment = VerticalAlignment.Center;
e_5.Text = "Button";
// button1 element
Button button1 = new Button();
e_4.Children.Add(button1);
button1.Name = "button1";
button1.Height = 30F;
button1.Width = 200F;
button1.Margin = new Thickness(5F, 5F, 5F, 5F);
button1.HorizontalAlignment = HorizontalAlignment.Left;
button1.TabIndex = 1;
button1.Content = "Button 1";
button1.CommandParameter = "Click Button 1";
Grid.SetColumn(button1, 1);
Grid.SetRow(button1, 0);
Binding binding_button1_Command = new Binding("ButtonCommand");
button1.SetBinding(Button.CommandProperty, binding_button1_Command);
// button2 element
Button button2 = new Button();
e_4.Children.Add(button2);
button2.Name = "button2";
button2.Height = 30F;
button2.Width = 200F;
button2.Margin = new Thickness(5F, 5F, 5F, 5F);
button2.HorizontalAlignment = HorizontalAlignment.Left;
button2.TabIndex = 2;
button2.Content = "Button 2";
button2.CommandParameter = "Click Button 2";
Grid.SetColumn(button2, 1);
Grid.SetRow(button2, 1);
Binding binding_button2_IsEnabled = new Binding("ButtonEnabled");
button2.SetBinding(Button.IsEnabledProperty, binding_button2_IsEnabled);
Binding binding_button2_Command = new Binding("ButtonCommand");
button2.SetBinding(Button.CommandProperty, binding_button2_Command);
// buttonResult element
TextBlock buttonResult = new TextBlock();
e_4.Children.Add(buttonResult);
buttonResult.Name = "buttonResult";
buttonResult.HorizontalAlignment = HorizontalAlignment.Left;
Grid.SetColumn(buttonResult, 1);
Grid.SetRow(buttonResult, 2);
Binding binding_buttonResult_Text = new Binding("ButtonResult");
buttonResult.SetBinding(TextBlock.TextProperty, binding_buttonResult_Text);
// e_6 element
TextBlock e_6 = new TextBlock();
e_4.Children.Add(e_6);
e_6.Name = "e_6";
e_6.VerticalAlignment = VerticalAlignment.Center;
e_6.Text = "CheckBox";
//.........这里部分代码省略.........
示例2: Get_TabControl_Items
private static System.Collections.ObjectModel.ObservableCollection<object> Get_TabControl_Items()
{
System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
// e_3 element
TabItem e_3 = new TabItem();
e_3.Name = "e_3";
e_3.HorizontalContentAlignment = HorizontalAlignment.Stretch;
e_3.Header = "Controls";
// e_4 element
Grid e_4 = new Grid();
e_3.Content = e_4;
e_4.Name = "e_4";
RowDefinition row_e_4_0 = new RowDefinition();
row_e_4_0.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_0);
RowDefinition row_e_4_1 = new RowDefinition();
row_e_4_1.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_1);
RowDefinition row_e_4_2 = new RowDefinition();
row_e_4_2.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_2);
RowDefinition row_e_4_3 = new RowDefinition();
row_e_4_3.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_3);
RowDefinition row_e_4_4 = new RowDefinition();
row_e_4_4.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_4);
RowDefinition row_e_4_5 = new RowDefinition();
row_e_4_5.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_5);
RowDefinition row_e_4_6 = new RowDefinition();
row_e_4_6.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_6);
RowDefinition row_e_4_7 = new RowDefinition();
row_e_4_7.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_7);
RowDefinition row_e_4_8 = new RowDefinition();
row_e_4_8.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_8);
RowDefinition row_e_4_9 = new RowDefinition();
row_e_4_9.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_9);
RowDefinition row_e_4_10 = new RowDefinition();
row_e_4_10.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_10);
RowDefinition row_e_4_11 = new RowDefinition();
row_e_4_11.Height = new GridLength(1F, GridUnitType.Auto);
e_4.RowDefinitions.Add(row_e_4_11);
ColumnDefinition col_e_4_0 = new ColumnDefinition();
col_e_4_0.Width = new GridLength(1F, GridUnitType.Auto);
e_4.ColumnDefinitions.Add(col_e_4_0);
ColumnDefinition col_e_4_1 = new ColumnDefinition();
e_4.ColumnDefinitions.Add(col_e_4_1);
// e_5 element
TextBlock e_5 = new TextBlock();
e_4.Children.Add(e_5);
e_5.Name = "e_5";
e_5.VerticalAlignment = VerticalAlignment.Center;
e_5.Text = "Button";
// button1 element
Button button1 = new Button();
e_4.Children.Add(button1);
button1.Name = "button1";
button1.Height = 30F;
button1.Width = 200F;
button1.Margin = new Thickness(5F, 5F, 5F, 5F);
button1.HorizontalAlignment = HorizontalAlignment.Left;
button1.TabIndex = 1;
button1.Content = "Button 1";
button1.CommandParameter = "Click Button 1";
Grid.SetColumn(button1, 1);
Grid.SetRow(button1, 0);
Binding binding_button1_Command = new Binding("ButtonCommand");
button1.SetBinding(Button.CommandProperty, binding_button1_Command);
// button2 element
Button button2 = new Button();
e_4.Children.Add(button2);
button2.Name = "button2";
button2.Height = 30F;
button2.Width = 200F;
button2.Margin = new Thickness(5F, 5F, 5F, 5F);
button2.HorizontalAlignment = HorizontalAlignment.Left;
button2.TabIndex = 2;
button2.Content = "Button 2";
button2.CommandParameter = "Click Button 2";
Grid.SetColumn(button2, 1);
Grid.SetRow(button2, 1);
Binding binding_button2_IsEnabled = new Binding("ButtonEnabled");
button2.SetBinding(Button.IsEnabledProperty, binding_button2_IsEnabled);
Binding binding_button2_Command = new Binding("ButtonCommand");
button2.SetBinding(Button.CommandProperty, binding_button2_Command);
// buttonResult element
TextBlock buttonResult = new TextBlock();
e_4.Children.Add(buttonResult);
buttonResult.Name = "buttonResult";
buttonResult.HorizontalAlignment = HorizontalAlignment.Left;
Grid.SetColumn(buttonResult, 1);
Grid.SetRow(buttonResult, 2);
Binding binding_buttonResult_Text = new Binding("ButtonResult");
buttonResult.SetBinding(TextBlock.TextProperty, binding_buttonResult_Text);
//.........这里部分代码省略.........