当前位置: 首页>>代码示例>>C#>>正文


C# Grid.SetBinding方法代码示例

本文整理汇总了C#中Grid.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.SetBinding方法的具体用法?C# Grid.SetBinding怎么用?C# Grid.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Grid的用法示例。


在下文中一共展示了Grid.SetBinding方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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";
//.........这里部分代码省略.........
开发者ID:Mike-EEE,项目名称:UI_Examples,代码行数:101,代码来源:BasicUI.xaml.cs

示例2: RandomizedBlankTile

 /// <summary>
 /// Prázdná dlaždice. Je jimivydlážděna plocha
 /// </summary>
 /// <param name="rowNum"></param>
 /// <param name="colNum"></param>
 /// <returns></returns>
 public Grid RandomizedBlankTile(int rowNum, int colNum) 
 {
     
     Grid tile = new Grid();
     tile.Background = new SolidColorBrush(Colors.Black);
     try
     {
         Binding colorBinding = new Binding();
         colorBinding.Source = App.ViewModel;
         colorBinding.Path = new PropertyPath("CurrentStation.Quality");
         colorBinding.Converter = new ColorQualityConverter();
         tile.SetBinding(Grid.BackgroundProperty, colorBinding);
     }
     catch (Exception)
     {
         
        
     }
     tile.Name = "BlankTile";
     tile.Children.Clear();
     //tile.Opacity = ((double)(random.Next(50, 100))) / 100;
     tile.Opacity = ((double)(random.Next(40, 70))) / 100;//pro fotky na pozadí
     Grid.SetRow(tile, rowNum);
     Grid.SetColumn(tile, colNum);
     return tile;
     
 }
开发者ID:Qerts,项目名称:Projekt-Pollution-MKII,代码行数:33,代码来源:Tile.cs

示例3: 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);
//.........这里部分代码省略.........
开发者ID:EmptyKeys,项目名称:UI_Examples,代码行数:101,代码来源:BasicUI.xaml.cs

示例4: mainStatusTile

        /// <summary>
        /// Hlavní dlaždice pro zobrazení jména stanice a smajlíka.
        /// </summary>
        /// <param name="rowNum"></param>
        /// <param name="colNum"></param>
        /// <returns></returns>
        public Grid mainStatusTile(int rowNum, int colNum)
        {
            Grid tile = new Grid();
            tile.Opacity = 1;
            try
            {
                Binding colorBinding = new Binding();
                colorBinding.Source = App.ViewModel;
                colorBinding.Path = new PropertyPath("CurrentStation.Quality");
                colorBinding.Converter = new ColorQualityConverter();
                tile.SetBinding(Grid.BackgroundProperty, colorBinding);
            }
            catch (Exception)
            {
            } Grid.SetRow(tile, rowNum);
            Grid.SetColumn(tile, colNum);
            Grid.SetRowSpan(tile, 2);
            Grid.SetColumnSpan(tile, 2);


            RowDefinition rowdef1 = new RowDefinition();
            rowdef1.Height = new GridLength(1, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef1);
            RowDefinition rowdef2 = new RowDefinition();
            rowdef2.Height = new GridLength(2, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef2);
            RowDefinition rowdef3 = new RowDefinition();
            rowdef3.Height = new GridLength(1, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef3);

            ColumnDefinition coldef1 = new ColumnDefinition();
            coldef1.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef1);
            ColumnDefinition coldef2 = new ColumnDefinition();
            coldef2.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef2);
            ColumnDefinition coldef3 = new ColumnDefinition();
            coldef3.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef3);
            ColumnDefinition coldef4 = new ColumnDefinition();
            coldef4.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef4);
            ColumnDefinition coldef5 = new ColumnDefinition();
            coldef5.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef5);

            /*
            TextBlock statusTitle = new TextBlock();
            //bude pravděpodobně třeba změnit pro plynulé přepínání jazyka
            statusTitle.Text = _resourceLoader.GetString("StatusTitle");
            statusTitle.FontSize = Data.getFontSize_LargeText();
            statusTitle.VerticalAlignment = VerticalAlignment.Center;
            statusTitle.HorizontalAlignment = HorizontalAlignment.Center;
            Grid.SetColumnSpan(statusTitle, 2);
            tile.Children.Add(statusTitle);
            */

            Image img = new Image();
            //bude třeba změnit por plynulou změnu obrázku
            Binding imageBinding = new Binding();
            imageBinding.Source = App.ViewModel;
            imageBinding.Path = new PropertyPath("CurrentStation.Quality");
            imageBinding.Converter = new ImageQualityConverter();
            img.SetBinding(Image.SourceProperty, imageBinding);
            Grid.SetRow(img, 1);
            Grid.SetColumn(img, 1);
            Grid.SetColumnSpan(img, 3);
            img.Stretch = Stretch.Uniform;
            tile.Children.Add(img);

            Viewbox view = new Viewbox();
            TextBlock stationName = new TextBlock();
            Binding b = new Binding();
            try
            {
                Binding nameBinding = new Binding();
                nameBinding.Source = App.ViewModel;
                nameBinding.Path = new PropertyPath("CurrentStation.Name");
                stationName.SetBinding(TextBlock.TextProperty, nameBinding);
            }
            catch (Exception)
            {
            } 
            
            stationName.FontSize = Data.getFontSize_LargeText();
            stationName.TextAlignment = TextAlignment.Center;
            stationName.VerticalAlignment = VerticalAlignment.Center;
            stationName.FontWeight = FontWeights.Bold;
            stationName.FontSize = 20;
            stationName.Height = 20;
            stationName.Margin = new Thickness(5, 0, 5, 0);

            Grid.SetColumnSpan(view, 5);
            Grid.SetRow(view, 2);
//.........这里部分代码省略.........
开发者ID:Qerts,项目名称:Projekt-Pollution-MKII,代码行数:101,代码来源:Tile.cs

示例5: statusTile_SO2

        public Grid statusTile_SO2(int rowNum, int colNum)
        {
            //pro pripad nemoznosti nacist stav
            string status = "error";

            Grid tile = new Grid();
            Grid.SetRow(tile, rowNum);
            Grid.SetColumn(tile, colNum);
            try
            {
                Binding colorBinding = new Binding();
                colorBinding.Source = App.ViewModel;
                colorBinding.Path = new PropertyPath("CurrentStation.So2.State");
                colorBinding.Converter = new ColorQualityConverter();
                tile.SetBinding(Grid.BackgroundProperty, colorBinding);
            }
            catch (Exception)            {            }

            RowDefinition rowdef1 = new RowDefinition();
            rowdef1.Height = new GridLength(2, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef1);
            RowDefinition rowdef2 = new RowDefinition();
            rowdef2.Height = new GridLength(4, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef2);
            RowDefinition rowdef3 = new RowDefinition();
            rowdef3.Height = new GridLength(2, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef3);
            RowDefinition rowdef4 = new RowDefinition();
            rowdef4.Height = new GridLength(1, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef4);
            RowDefinition rowdef5 = new RowDefinition();
            rowdef5.Height = new GridLength(2, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef5); 
            RowDefinition rowdef6 = new RowDefinition();
            rowdef6.Height = new GridLength(1, GridUnitType.Star);
            tile.RowDefinitions.Add(rowdef6);

            ColumnDefinition coldef1 = new ColumnDefinition();
            coldef1.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef1);
            ColumnDefinition coldef2 = new ColumnDefinition();
            coldef2.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef2);
            ColumnDefinition coldef3 = new ColumnDefinition();
            coldef3.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef3);
            ColumnDefinition coldef4 = new ColumnDefinition();
            coldef4.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef4);
            ColumnDefinition coldef5 = new ColumnDefinition();
            coldef5.Width = new GridLength(1, GridUnitType.Star);
            tile.ColumnDefinitions.Add(coldef5);

            //nabindování
            TextBlock ratingString = new TextBlock();
            ratingString.Text = "SO2";
            Binding valueBinding = new Binding();
            valueBinding.Source = App.ViewModel;
            valueBinding.Path = new PropertyPath("CurrentStation.So2.Value");
            valueBinding.Converter = new NegativeValueConverter();
            ratingString.SetBinding(TextBlock.TextProperty, valueBinding);    

            ratingString.Foreground = new SolidColorBrush(Colors.White);
            ratingString.FontSize = Data.getFontSize_StatuValue();
            ratingString.TextAlignment = TextAlignment.Center;
            ratingString.HorizontalAlignment = HorizontalAlignment.Center;
            ratingString.VerticalAlignment = VerticalAlignment.Center;

            ratingString.FontSize = 150;
            Viewbox view = new Viewbox();
            view.Child = ratingString;
            view.HorizontalAlignment = HorizontalAlignment.Center;
            view.VerticalAlignment = VerticalAlignment.Center;
            Grid.SetColumn(view, 0);
            Grid.SetColumnSpan(view, 5);
            Grid.SetRow(view, 1);

            tile.Children.Add(view);
            
            TextBlock stationString = new TextBlock();
            try
            {
                Binding statusBinding = new Binding();
                statusBinding.Source = App.ViewModel;
                statusBinding.Path = new PropertyPath("CurrentStation.So2.State");
                statusBinding.Converter = new ColorQualityConverter();
                stationString.SetBinding(TextBlock.TextProperty, statusBinding);
            }
            catch (Exception)
            {
            } stationString.Foreground = new SolidColorBrush(Colors.White);
            stationString.TextAlignment = TextAlignment.Center;
            stationString.HorizontalAlignment = HorizontalAlignment.Center;
            stationString.VerticalAlignment = VerticalAlignment.Center;
            stationString.FontWeight = FontWeights.Bold;

            stationString.FontSize = 50;
            Viewbox view3 = new Viewbox();
            view3.Child = stationString;
            view3.HorizontalAlignment = HorizontalAlignment.Center;
//.........这里部分代码省略.........
开发者ID:Qerts,项目名称:Projekt-Pollution-MKII,代码行数:101,代码来源:Tile.cs

示例6: 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;
 }
开发者ID:charbean,项目名称:StrategyClean,代码行数:76,代码来源:Root.xaml.cs

示例7: 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);
//.........这里部分代码省略.........
开发者ID:charbean,项目名称:StrategyClean,代码行数:101,代码来源:Root.xaml.cs

示例8: Get_PlanetInfoTabs_Items

 private static System.Collections.ObjectModel.ObservableCollection<object> Get_PlanetInfoTabs_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // tabInfo element
     TabItem tabInfo = new TabItem();
     tabInfo.Name = "tabInfo";
     tabInfo.Header = "Information";
     // e_94 element
     Grid e_94 = new Grid();
     tabInfo.Content = e_94;
     e_94.Name = "e_94";
     e_94.IsHitTestVisible = false;
     ColumnDefinition col_e_94_0 = new ColumnDefinition();
     col_e_94_0.Width = new GridLength(0.4F, GridUnitType.Star);
     e_94.ColumnDefinitions.Add(col_e_94_0);
     ColumnDefinition col_e_94_1 = new ColumnDefinition();
     col_e_94_1.Width = new GridLength(1F, GridUnitType.Star);
     e_94.ColumnDefinitions.Add(col_e_94_1);
     Binding binding_e_94_DataContext = new Binding("InfoTabData");
     e_94.SetBinding(Grid.DataContextProperty, binding_e_94_DataContext);
     // e_95 element
     StackPanel e_95 = new StackPanel();
     e_94.Children.Add(e_95);
     e_95.Name = "e_95";
     e_95.Orientation = Orientation.Vertical;
     Grid.SetColumn(e_95, 0);
     // e_96 element
     TextBlock e_96 = new TextBlock();
     e_95.Children.Add(e_96);
     e_96.Name = "e_96";
     e_96.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_96_Text = new Binding("PNameText");
     e_96.SetBinding(TextBlock.TextProperty, binding_e_96_Text);
     // e_97 element
     TextBlock e_97 = new TextBlock();
     e_95.Children.Add(e_97);
     e_97.Name = "e_97";
     e_97.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_97_Text = new Binding("PTierText");
     e_97.SetBinding(TextBlock.TextProperty, binding_e_97_Text);
     // e_98 element
     TextBlock e_98 = new TextBlock();
     e_95.Children.Add(e_98);
     e_98.Name = "e_98";
     e_98.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_98_Text = new Binding("PSpeedText");
     e_98.SetBinding(TextBlock.TextProperty, binding_e_98_Text);
     // e_99 element
     TextBlock e_99 = new TextBlock();
     e_95.Children.Add(e_99);
     e_99.Name = "e_99";
     e_99.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_99_Text = new Binding("PDistanceText");
     e_99.SetBinding(TextBlock.TextProperty, binding_e_99_Text);
     // e_100 element
     TextBlock e_100 = new TextBlock();
     e_95.Children.Add(e_100);
     e_100.Name = "e_100";
     e_100.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_100_Text = new Binding("PHabitedText");
     e_100.SetBinding(TextBlock.TextProperty, binding_e_100_Text);
     // e_101 element
     TextBlock e_101 = new TextBlock();
     e_95.Children.Add(e_101);
     e_101.Name = "e_101";
     e_101.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_101_Text = new Binding("PPopulationText");
     e_101.SetBinding(TextBlock.TextProperty, binding_e_101_Text);
     // e_102 element
     TextBlock e_102 = new TextBlock();
     e_95.Children.Add(e_102);
     e_102.Name = "e_102";
     e_102.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_102_Text = new Binding("PPopIncRateText");
     e_102.SetBinding(TextBlock.TextProperty, binding_e_102_Text);
     // e_103 element
     TextBlock e_103 = new TextBlock();
     e_95.Children.Add(e_103);
     e_103.Name = "e_103";
     e_103.Margin = new Thickness(5F, 5F, 0F, 5F);
     Binding binding_e_103_Text = new Binding("POwnerText");
     e_103.SetBinding(TextBlock.TextProperty, binding_e_103_Text);
     // e_104 element
     StackPanel e_104 = new StackPanel();
     e_94.Children.Add(e_104);
     e_104.Name = "e_104";
     e_104.HorizontalAlignment = HorizontalAlignment.Right;
     Grid.SetColumn(e_104, 1);
     // e_105 element
     TextBlock e_105 = new TextBlock();
     e_104.Children.Add(e_105);
     e_105.Name = "e_105";
     e_105.Text = "Map";
     // e_106 element
     Image e_106 = new Image();
     e_104.Children.Add(e_106);
     e_106.Name = "e_106";
     Binding binding_e_106_Source = new Binding("MapImage");
     e_106.SetBinding(Image.SourceProperty, binding_e_106_Source);
     items.Add(tabInfo);
     // tabAdmin element
//.........这里部分代码省略.........
开发者ID:charbean,项目名称:StrategyClean,代码行数:101,代码来源:Root.xaml.cs


注:本文中的Grid.SetBinding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。