本文整理汇总了C#中ListBox.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.SetBinding方法的具体用法?C# ListBox.SetBinding怎么用?C# ListBox.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListBox
的用法示例。
在下文中一共展示了ListBox.SetBinding方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get_e_5_Items
private static System.Collections.ObjectModel.ObservableCollection<object> Get_e_5_Items()
{
System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
// e_6 element
TabItem e_6 = new TabItem();
e_6.Name = "e_6";
e_6.HorizontalContentAlignment = HorizontalAlignment.Stretch;
e_6.Header = "Tab 1";
// e_7 element
ListBox e_7 = new ListBox();
e_6.Content = e_7;
e_7.Name = "e_7";
e_7.Height = 100F;
Func<UIElement, UIElement> e_7_dtFunc = e_7_dtMethod;
e_7.ItemTemplate = new DataTemplate(e_7_dtFunc);
Binding binding_e_7_ItemsSource = new Binding("ComboBoxSource");
e_7.SetBinding(ListBox.ItemsSourceProperty, binding_e_7_ItemsSource);
Binding binding_e_7_SelectedItem = new Binding("SelectedItem");
e_7.SetBinding(ListBox.SelectedItemProperty, binding_e_7_SelectedItem);
items.Add(e_6);
// e_9 element
TabItem e_9 = new TabItem();
e_9.Name = "e_9";
e_9.Header = "Tab 2";
// e_10 element
StackPanel e_10 = new StackPanel();
e_9.Content = e_10;
e_10.Name = "e_10";
// e_11 element
ListBox e_11 = new ListBox();
e_10.Children.Add(e_11);
e_11.Name = "e_11";
e_11.Height = 100F;
e_11.ItemsSource = Get_e_11_Items();
items.Add(e_9);
// e_16 element
TabItem e_16 = new TabItem();
e_16.Name = "e_16";
e_16.Content = "Tab 3 Content";
e_16.Header = "Tab 3";
items.Add(e_16);
// e_17 element
TabItem e_17 = new TabItem();
e_17.Name = "e_17";
e_17.Content = "Tab 4 Content";
e_17.Header = "Tab 4";
items.Add(e_17);
return items;
}
示例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);
//.........这里部分代码省略.........
示例3: Get_e_151_Items
private static System.Collections.ObjectModel.ObservableCollection<object> Get_e_151_Items() {
System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
// tabAllConst element
TabItem tabAllConst = new TabItem();
tabAllConst.Name = "tabAllConst";
tabAllConst.Header = "All Constructions";
// e_152 element
ScrollViewer e_152 = new ScrollViewer();
tabAllConst.Content = e_152;
e_152.Name = "e_152";
Binding binding_e_152_IsEnabled = new Binding("IsUIEnabled");
e_152.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_152_IsEnabled);
// e_153 element
Grid e_153 = new Grid();
e_152.Content = e_153;
e_153.Name = "e_153";
ColumnDefinition col_e_153_0 = new ColumnDefinition();
e_153.ColumnDefinitions.Add(col_e_153_0);
ColumnDefinition col_e_153_1 = new ColumnDefinition();
e_153.ColumnDefinitions.Add(col_e_153_1);
Binding binding_e_153_DataContext = new Binding("PlanetBuildingsData");
e_153.SetBinding(Grid.DataContextProperty, binding_e_153_DataContext);
items.Add(tabAllConst);
// tabUnusedRes element
TabItem tabUnusedRes = new TabItem();
tabUnusedRes.Name = "tabUnusedRes";
tabUnusedRes.Header = "Unused Resources";
// e_154 element
ScrollViewer e_154 = new ScrollViewer();
tabUnusedRes.Content = e_154;
e_154.Name = "e_154";
Binding binding_e_154_IsEnabled = new Binding("IsUIEnabled");
e_154.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_154_IsEnabled);
// e_155 element
Grid e_155 = new Grid();
e_154.Content = e_155;
e_155.Name = "e_155";
ColumnDefinition col_e_155_0 = new ColumnDefinition();
e_155.ColumnDefinitions.Add(col_e_155_0);
ColumnDefinition col_e_155_1 = new ColumnDefinition();
e_155.ColumnDefinitions.Add(col_e_155_1);
Binding binding_e_155_DataContext = new Binding("PlanetBuildingsData");
e_155.SetBinding(Grid.DataContextProperty, binding_e_155_DataContext);
// e_156 element
ListBox e_156 = new ListBox();
e_155.Children.Add(e_156);
e_156.Name = "e_156";
ToolTipService.SetInitialShowDelay(e_156, 0);
Grid.SetColumn(e_156, 0);
ScrollViewer.SetCanContentScroll(e_156, false);
ScrollViewer.SetHorizontalScrollBarVisibility(e_156, ScrollBarVisibility.Hidden);
ScrollViewer.SetVerticalScrollBarVisibility(e_156, ScrollBarVisibility.Hidden);
Binding binding_e_156_IsEnabled = new Binding("IsUIEnabled");
e_156.SetBinding(ListBox.IsEnabledProperty, binding_e_156_IsEnabled);
Binding binding_e_156_ItemsSource = new Binding("UnusedResourceIcons");
e_156.SetBinding(ListBox.ItemsSourceProperty, binding_e_156_ItemsSource);
Binding binding_e_156_SelectedIndex = new Binding("SelectedUnusedResource");
e_156.SetBinding(ListBox.SelectedIndexProperty, binding_e_156_SelectedIndex);
// e_157 element
ListBox e_157 = new ListBox();
e_155.Children.Add(e_157);
e_157.Name = "e_157";
ToolTipService.SetInitialShowDelay(e_157, 0);
Grid.SetColumn(e_157, 1);
ScrollViewer.SetCanContentScroll(e_157, false);
ScrollViewer.SetHorizontalScrollBarVisibility(e_157, ScrollBarVisibility.Hidden);
ScrollViewer.SetVerticalScrollBarVisibility(e_157, ScrollBarVisibility.Hidden);
Binding binding_e_157_IsEnabled = new Binding("IsUIEnabled");
e_157.SetBinding(ListBox.IsEnabledProperty, binding_e_157_IsEnabled);
Binding binding_e_157_ItemsSource = new Binding("UnusedResourceNames");
e_157.SetBinding(ListBox.ItemsSourceProperty, binding_e_157_ItemsSource);
Binding binding_e_157_SelectedIndex = new Binding("SelectedUnusedResource");
e_157.SetBinding(ListBox.SelectedIndexProperty, binding_e_157_SelectedIndex);
items.Add(tabUnusedRes);
return items;
}
示例4: Get_e_9_Items
private static System.Collections.ObjectModel.ObservableCollection<object> Get_e_9_Items()
{
System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
// e_10 element
TabItem e_10 = new TabItem();
e_10.Name = "e_10";
e_10.HorizontalContentAlignment = HorizontalAlignment.Stretch;
e_10.Header = "Tab 1";
// e_11 element
ListBox e_11 = new ListBox();
e_10.Content = e_11;
e_11.Name = "e_11";
e_11.Height = 100F;
Func<UIElement, UIElement> e_11_dtFunc = e_11_dtMethod;
e_11.ItemTemplate = new DataTemplate(e_11_dtFunc);
Binding binding_e_11_ItemsSource = new Binding("ComboBoxSource");
e_11.SetBinding(ListBox.ItemsSourceProperty, binding_e_11_ItemsSource);
Binding binding_e_11_SelectedItem = new Binding("SelectedItem");
e_11.SetBinding(ListBox.SelectedItemProperty, binding_e_11_SelectedItem);
items.Add(e_10);
// e_13 element
TabItem e_13 = new TabItem();
e_13.Name = "e_13";
e_13.Header = "Tab 2";
// e_14 element
StackPanel e_14 = new StackPanel();
e_13.Content = e_14;
e_14.Name = "e_14";
// e_15 element
ListBox e_15 = new ListBox();
e_14.Children.Add(e_15);
e_15.Name = "e_15";
e_15.Height = 100F;
e_15.ItemsSource = Get_e_15_Items();
items.Add(e_13);
// e_20 element
TabItem e_20 = new TabItem();
e_20.Name = "e_20";
e_20.Content = "Tab 3 Content";
e_20.Header = "Tab 3";
items.Add(e_20);
// e_21 element
TabItem e_21 = new TabItem();
e_21.Name = "e_21";
e_21.Content = "Tab 4 Content";
e_21.Header = "Tab 4";
items.Add(e_21);
return items;
}
示例5: Get_e_114_Items
private static System.Collections.ObjectModel.ObservableCollection<object> Get_e_114_Items() {
System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
// tabAllBuildings element
TabItem tabAllBuildings = new TabItem();
tabAllBuildings.Name = "tabAllBuildings";
tabAllBuildings.Header = "All";
// e_115 element
ScrollViewer e_115 = new ScrollViewer();
tabAllBuildings.Content = e_115;
e_115.Name = "e_115";
e_115.HorizontalAlignment = HorizontalAlignment.Stretch;
Binding binding_e_115_IsEnabled = new Binding("IsUIEnabled");
e_115.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_115_IsEnabled);
// e_116 element
Grid e_116 = new Grid();
e_115.Content = e_116;
e_116.Name = "e_116";
ColumnDefinition col_e_116_0 = new ColumnDefinition();
e_116.ColumnDefinitions.Add(col_e_116_0);
ColumnDefinition col_e_116_1 = new ColumnDefinition();
e_116.ColumnDefinitions.Add(col_e_116_1);
Binding binding_e_116_DataContext = new Binding("PlanetBuildingsData");
e_116.SetBinding(Grid.DataContextProperty, binding_e_116_DataContext);
// e_117 element
ListBox e_117 = new ListBox();
e_116.Children.Add(e_117);
e_117.Name = "e_117";
ToolTipService.SetInitialShowDelay(e_117, 0);
Grid.SetColumn(e_117, 0);
ScrollViewer.SetCanContentScroll(e_117, false);
ScrollViewer.SetHorizontalScrollBarVisibility(e_117, ScrollBarVisibility.Hidden);
ScrollViewer.SetVerticalScrollBarVisibility(e_117, ScrollBarVisibility.Hidden);
Binding binding_e_117_IsEnabled = new Binding("IsUIEnabled");
e_117.SetBinding(ListBox.IsEnabledProperty, binding_e_117_IsEnabled);
Binding binding_e_117_ItemsSource = new Binding("BuildingIcons");
e_117.SetBinding(ListBox.ItemsSourceProperty, binding_e_117_ItemsSource);
Binding binding_e_117_SelectedIndex = new Binding("SelectedBuilding");
e_117.SetBinding(ListBox.SelectedIndexProperty, binding_e_117_SelectedIndex);
// e_118 element
ListBox e_118 = new ListBox();
e_116.Children.Add(e_118);
e_118.Name = "e_118";
ToolTipService.SetInitialShowDelay(e_118, 0);
Grid.SetColumn(e_118, 1);
ScrollViewer.SetCanContentScroll(e_118, false);
ScrollViewer.SetHorizontalScrollBarVisibility(e_118, ScrollBarVisibility.Hidden);
ScrollViewer.SetVerticalScrollBarVisibility(e_118, ScrollBarVisibility.Hidden);
Binding binding_e_118_IsEnabled = new Binding("IsUIEnabled");
e_118.SetBinding(ListBox.IsEnabledProperty, binding_e_118_IsEnabled);
Binding binding_e_118_ItemsSource = new Binding("BuildingNames");
e_118.SetBinding(ListBox.ItemsSourceProperty, binding_e_118_ItemsSource);
Binding binding_e_118_SelectedIndex = new Binding("SelectedBuilding");
e_118.SetBinding(ListBox.SelectedIndexProperty, binding_e_118_SelectedIndex);
items.Add(tabAllBuildings);
// tabResourceBuildings element
TabItem tabResourceBuildings = new TabItem();
tabResourceBuildings.Name = "tabResourceBuildings";
tabResourceBuildings.Header = "Resources";
// e_119 element
ScrollViewer e_119 = new ScrollViewer();
tabResourceBuildings.Content = e_119;
e_119.Name = "e_119";
e_119.Width = 490F;
e_119.HorizontalAlignment = HorizontalAlignment.Stretch;
Binding binding_e_119_IsEnabled = new Binding("IsUIEnabled");
e_119.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_119_IsEnabled);
// e_120 element
Grid e_120 = new Grid();
e_119.Content = e_120;
e_120.Name = "e_120";
ColumnDefinition col_e_120_0 = new ColumnDefinition();
col_e_120_0.Width = new GridLength(1F, GridUnitType.Auto);
e_120.ColumnDefinitions.Add(col_e_120_0);
ColumnDefinition col_e_120_1 = new ColumnDefinition();
col_e_120_1.Width = new GridLength(1F, GridUnitType.Auto);
e_120.ColumnDefinitions.Add(col_e_120_1);
Binding binding_e_120_DataContext = new Binding("PlanetBuildingsData");
e_120.SetBinding(Grid.DataContextProperty, binding_e_120_DataContext);
// e_121 element
ListBox e_121 = new ListBox();
e_120.Children.Add(e_121);
e_121.Name = "e_121";
ToolTipService.SetInitialShowDelay(e_121, 0);
Grid.SetColumn(e_121, 0);
ScrollViewer.SetCanContentScroll(e_121, false);
ScrollViewer.SetHorizontalScrollBarVisibility(e_121, ScrollBarVisibility.Hidden);
ScrollViewer.SetVerticalScrollBarVisibility(e_121, ScrollBarVisibility.Hidden);
Binding binding_e_121_IsEnabled = new Binding("IsUIEnabled");
e_121.SetBinding(ListBox.IsEnabledProperty, binding_e_121_IsEnabled);
Binding binding_e_121_ItemsSource = new Binding("ResourcesBuildingIcons");
e_121.SetBinding(ListBox.ItemsSourceProperty, binding_e_121_ItemsSource);
Binding binding_e_121_SelectedIndex = new Binding("ResourcesSelectedBuilding");
e_121.SetBinding(ListBox.SelectedIndexProperty, binding_e_121_SelectedIndex);
// e_122 element
ListBox e_122 = new ListBox();
e_120.Children.Add(e_122);
e_122.Name = "e_122";
ToolTipService.SetInitialShowDelay(e_122, 0);
Grid.SetColumn(e_122, 1);
ScrollViewer.SetCanContentScroll(e_122, false);
//.........这里部分代码省略.........