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


C# GridLength类代码示例

本文整理汇总了C#中GridLength的典型用法代码示例。如果您正苦于以下问题:C# GridLength类的具体用法?C# GridLength怎么用?C# GridLength使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GridLength类属于命名空间,在下文中一共展示了GridLength类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowPannel

        private void ShowPannel(object sender, EventArgs e)
        {
            BitmapImage logo = new BitmapImage();

            logo.BeginInit();
            if (!isPannelShow)
            {
                spliterWidth = new GridLength(panelSize);
                isPannelShow = true;
                logo.UriSource = new Uri(@"Images\HidePannel.png", UriKind.Relative);
                PannelDrag.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                spliterWidth = new GridLength(0.0);
                isPannelShow = false;
                logo.UriSource = new Uri(@"Images\ShowPannel.png", UriKind.Relative);
                PannelDrag.Visibility = System.Windows.Visibility.Hidden;
            }
            logo.EndInit();

            this.ShowPannelButton.Source = logo;
            PannelGrid.Width = spliterWidth.Value;
            MediaGrid.Margin = new System.Windows.Thickness(0, 0, spliterWidth.Value, 0);
            LibraryGrid.Margin = new System.Windows.Thickness(0, 0, spliterWidth.Value, 0);
            PannelDrag.Margin = new System.Windows.Thickness(0, 0, spliterWidth.Value - 2, 0);
        }
开发者ID:Haseo,项目名称:project-WMP,代码行数:27,代码来源:MainWindowMenu.cs

示例2: ButtonHideControls_OnClick

 private void ButtonHideControls_OnClick(object sender, RoutedEventArgs e)
 {
     ButtonHideControls.Visibility = Visibility.Collapsed;
     ButtonShowControls.Visibility = Visibility.Visible;
     ControlsHeight = RowControls.Height;
     RowControls.Height = new GridLength(0);
 }
开发者ID:dtegunov,项目名称:membranorama,代码行数:7,代码来源:PatchWindow.xaml.cs

示例3: AddCardColumn

        private void AddCardColumn(GridLength columnWidth, IEnumerable<Card> cardGroup)
        {
            foreach (Card c in cardGroup) {
                matrix.ColumnDefinitions.Add(new ColumnDefinition() { Width = columnWidth });
                TextBlock cardBlock = new TextBlock() {
                    Style = (Style)Resources["VerticalText"]
                };
                cardBlock.DataContext = c;
                cardBlock.SetBinding(TextBlock.TextProperty, new Binding("Name"));
                cardBlock.SetValue(Grid.ColumnProperty, matrix.ColumnDefinitions.Count - 1);
                cardBlock.SetValue(Grid.RowProperty, 1);
                matrix.Children.Add(cardBlock);

                // Fill in the individual nodes for this card.
                foreach (Player player in game.Players) {
                    Node node = game.Nodes.Where(n => n.CardHolder == player && n.Card == c).First();
                    Label nodeLabel = new Label();
                    nodeLabel.SetValue(Grid.ColumnProperty, matrix.ColumnDefinitions.Count - 1);
                    nodeLabel.SetValue(Grid.RowProperty, game.Players.IndexOf(player) + 2);
                    nodeLabel.DataContext = node;
                    nodeLabel.SetBinding(Label.ContentProperty, new Binding("IsSelected"));
                    matrix.Children.Add(nodeLabel);
                }
            }
        }
开发者ID:AArnott,项目名称:ClueBuddy,代码行数:25,代码来源:ClueGrid.xaml.cs

示例4: myMainGridToggleButton_Checked

 private void myMainGridToggleButton_Checked(object sender, RoutedEventArgs e)
 {
     if (myMainGridFirstColumn.ActualWidth > myMainGridFirstColumn.MinWidth)
         _gridLength = myMainGridFirstColumn.Width;
     myMainGridFirstColumn.Width = new GridLength(myMainGridFirstColumn.MinWidth);
     this.myNavigationPaneButton.Visibility = Visibility.Visible;
 }
开发者ID:hanigamal,项目名称:rb-vms,代码行数:7,代码来源:MainView.xaml.cs

示例5: Redraw

        public void Redraw()
        {
            BoardGrid.Children.Clear();
            System.Windows.GridLength g = new GridLength(40);
            
            for (int v = 0; v < 15; v++)
            {
                BoardGrid.RowDefinitions.Add(new RowDefinition() { Height = g });
                for (int h = 0; h < 15; h++)
                {
                    BoardGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = g });
                    BoardSquare square = _allSquares[h, v];
                    if (v == 7 && h == 7)
                    {
                        square.Background = this.Resources["CenterSquare"] as Brush;
                    }
                    if (square.PlacedTile != null)
                    {
                        square.Redraw();
                    }

                    square.MyCoords = new Point(h, v);
                    
                    BoardGrid.Children.Add(square);

                    //horiz(x), vert(y)
                    Grid.SetColumn(square, h);
                    Grid.SetRow(square, v);
                }
            }

        }
开发者ID:JonPM,项目名称:sharpscrabble,代码行数:32,代码来源:DisplayBoard.xaml.cs

示例6: UpdateCategoryWidth

 private void UpdateCategoryWidth()
 {
     if (_categoryWidth.Value != _viewModel.CategoryColumnWidthRate)
     {
         _categoryWidth = new GridLength(_viewModel.CategoryColumnWidthRate, GridUnitType.Star);
         _menuSectionWidth = new GridLength(100 - _categoryWidth.Value, GridUnitType.Star);
     }
 }
开发者ID:GHLabs,项目名称:SambaPOS-3,代码行数:8,代码来源:MenuItemSelectorView.xaml.cs

示例7: LinkViewLayoutManager

 public LinkViewLayoutManager()
 {
     FirstColumnWidth = new GridLength(1, GridUnitType.Star);
     SecondColumnWidth = new GridLength(PictureColumnWidth, GridUnitType.Pixel);
     PictureColumn = 1;
     TextColumn = 0;
     Messenger.Default.Register<SettingsChangedMessage>(this, OnSettingsChanged);
 }
开发者ID:hippiehunter,项目名称:Baconography,代码行数:8,代码来源:LinkViewLayoutManager.cs

示例8: AddRow

 public static RowDefinition AddRow(this Grid grid, GridLength height)
 {
     var row = new RowDefinition
     {
         Height = height
     };
     grid.RowDefinitions.Add(row);
     return row;
 }
开发者ID:kswoll,项目名称:restless,代码行数:9,代码来源:GridExtensions.cs

示例9: AddColumn

 public static ColumnDefinition AddColumn(this Grid grid, GridLength width)
 {
     var column = new ColumnDefinition
     {
         Width = width
     };
     grid.ColumnDefinitions.Add(column);
     return column;
 }
开发者ID:kswoll,项目名称:restless,代码行数:9,代码来源:GridExtensions.cs

示例10: SetColumnDefinition

 private void SetColumnDefinition(bool hasParameters)
 {
     var column = ParametersGridColumn;
     if (column.Width.IsStar)
     {
         _lastGridLength = column.Width;
     }
     column.Width = hasParameters ? _lastGridLength : new GridLength(0, GridUnitType.Pixel);
 }
开发者ID:julianpaulozzi,项目名称:EntityProfiler,代码行数:9,代码来源:ContextDetailView.xaml.cs

示例11: MainWindow

 public MainWindow()
 {
     InitializeComponent();
       Loaded += switchLobby_Click;
       lobby.EnterSucceed += (user) =>
     new BattleWindow(user).Show();
       GL0 = new GridLength(0);
       GLMIN = new GridLength(lobby.MinWidth);
       editor.Init();
 }
开发者ID:sunoru,项目名称:PBO,代码行数:10,代码来源:MainWindow.xaml.cs

示例12: Button_Click

 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (layoutGrid.ColumnDefinitions[2].Width.Value > 0)
     {
         prevSidebarWidth = layoutGrid.ColumnDefinitions[2].Width;
         layoutGrid.ColumnDefinitions[2].Width = new GridLength(0);
     }
     else
     {
         layoutGrid.ColumnDefinitions[2].Width = prevSidebarWidth;
     }
 }
开发者ID:markshroyer,项目名称:FractalExplorer,代码行数:12,代码来源:MainPage.xaml.cs

示例13: getAnswers

        internal Grid getAnswers(List<bool> AnsweredList)
        {
            int RadioBtnCount = -1;

            Grid g = new Grid();
            g.Name = "AnswerGrid";
            g.Background = new SolidColorBrush(Colors.LightGray);

            ColumnDefinition col1 = new ColumnDefinition();
            GridLength gl = new GridLength(50);
            col1.Width = gl;
            ColumnDefinition col2 = new ColumnDefinition();
            g.ColumnDefinitions.Add(col1);
            g.ColumnDefinitions.Add(col2);

            for (int i = 0; i <AnswList.Count; i++)
            {
                RowDefinition r = new RowDefinition();
                g.RowDefinitions.Add(r);
            }
            int rowCount = 0;

            //building Grid
            foreach (KeyValuePair<string,bool> pairs in AnswList)
            {
                RadioBtnCount++;
                RadioButton rb = new RadioButton();
                if (AnsweredList == null) rb.IsChecked = false;
                else rb.IsChecked = AnsweredList[RadioBtnCount];

                RadioBtnList.Add(rb);
                rb.Click += rb_Click;
                rb.HorizontalAlignment = HorizontalAlignment.Center;
                rb.VerticalAlignment = VerticalAlignment.Center;
                Grid.SetColumn(rb, 0);
                Grid.SetRow(rb, rowCount);
                g.Children.Add(rb);

                TextBlock tb = new TextBlock();
                tb.MaxWidth = 710;
                tb.FontFamily = new FontFamily("Arial");
                tb.FontSize = 14;
                tb.TextWrapping = TextWrapping.Wrap;
                tb.Text = pairs.Key;
                tb.Margin = new Thickness(5, 3, 5, 3);

                Grid.SetColumn(tb, 1);
                Grid.SetRow(tb, rowCount);
                g.Children.Add(tb);
                rowCount++;
            }
            return g;
        }
开发者ID:sherlok901,项目名称:quizApp,代码行数:53,代码来源:ReversStudyTest.cs

示例14: SetSize

        public void SetSize(byte size)
        {
            size = Math.Max(size, MinSize);
            size = Math.Min(size, MaxSize);

            var marginGridLength = new GridLength((FullGridSize - size) / 2, GridUnitType.Star);
            var iconGridLength = new GridLength(size, GridUnitType.Star);

            LeftMarginColumn.Width = marginGridLength;
            RightMarginColumn.Width = marginGridLength;
            IconColumn.Width = iconGridLength;
        }
开发者ID:alex-shnayder,项目名称:Switchbox,代码行数:12,代码来源:SwitchButton.xaml.cs

示例15: BehaviorTest

        public void BehaviorTest()
        {
            #region Init

            var behavior = new GridColumnConditionalWidthsBehavior();

            var columnWidth1 = new GridLength(1, GridUnitType.Star);
            var columnWidth2 = new GridLength(200d);
            var columnWidth3 = GridLength.Auto;
            var columnNewWidth1 = new GridLength(1, GridUnitType.Star);
            var columnNewWidth2 = new GridLength(1, GridUnitType.Star);
            var columnNewWidth3 = new GridLength(100d);
            var conditionalWidth = new GridLength(2, GridUnitType.Star);

            var column1 = new ColumnDefinition() { Width = columnWidth1};
            var column2 = new ColumnDefinition() { Width = columnWidth2 };
            var column3 = new ColumnDefinition() { Width = columnWidth3 };
            var grid = new Grid {Width = 1000d};
            grid.ColumnDefinitions.Add(column1);
            grid.ColumnDefinitions.Add(column2);
            grid.ColumnDefinitions.Add(column3);

            behavior.Column = 2;
            behavior.ConditionalWidth = conditionalWidth;
            behavior.Attach(grid);

            #endregion Init

            behavior.Condition = true;

            //test ConditionalWidth
            Assert.AreEqual(column2.Width.Value, 200d);

            // grid layout changes
            column1.Width = columnNewWidth1;
            column2.Width = columnNewWidth2;
            column3.Width = columnNewWidth3;

            // test restore
            behavior.Condition = false;

            Assert.AreEqual(column1.Width, columnWidth1);
            Assert.AreEqual(column2.Width, columnWidth2);
            Assert.AreEqual(column3.Width, columnWidth3);

            // test saved
            behavior.Condition = true;

            Assert.AreEqual(column1.Width, columnNewWidth1);
            Assert.AreEqual(column2.Width, columnNewWidth2);
            Assert.AreEqual(column3.Width, columnNewWidth3);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:52,代码来源:GridColumnConditionalWidthsBehaviorTests.cs


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