Set control to specific row and column in code : Grid Operation « Windows Presentation Foundation « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Windows Presentation Foundation » Grid Operation 
16.35.15.Set control to specific row and column in code
<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="" Height="300" Width="300"
    >
</Window>


//File:Window.xaml.vb
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes


Namespace WpfApplication1
  Public Partial Class Window1
    Inherits System.Windows.Window

    Public Sub New()
      InitializeComponent()
      Dim As New Grid()
      Dim As New RowDefinition()
      r.Height = New GridLength(0, GridUnitType.Auto)
      g.RowDefinitions.Add(r)
      r = New RowDefinition()
      r.Height = New GridLength(2, GridUnitType.Star)
      g.RowDefinitions.Add(r)
      r = New RowDefinition()
      r.Height = New GridLength(1, GridUnitType.Star)
      g.RowDefinitions.Add(r)

      Dim As New ColumnDefinition()
      c.Width = New GridLength(0, GridUnitType.Auto)
      g.ColumnDefinitions.Add(c)
      c = New ColumnDefinition()
      g.ColumnDefinitions.Add(c)

      Dim tb As New TextBlock()
      tb.Text = "Protocol:"
      Grid.SetColumn(tb, 0)
      Grid.SetRow(tb, 0)
      g.Children.Add(tb)

      tb = New TextBlock()
      tb.Text = "HyperText Transfer Protocol:"
      Grid.SetColumn(tb, 1)
      Grid.SetRow(tb, 0)
      g.Children.Add(tb)

      tb = New TextBlock()
      tb.Text = "Type:"
      Grid.SetColumn(tb, 0)
      Grid.SetRow(tb, 1)
      g.Children.Add(tb)

      tb = New TextBlock()
      tb.Text = "HTML Document"
      Grid.SetColumn(tb, 1)
      Grid.SetRow(tb, 1)
      g.Children.Add(tb)

      tb = New TextBlock()
      tb.Text = "Connection:"
      Grid.SetColumn(tb, 0)
      Grid.SetRow(tb, 2)
      g.Children.Add(tb)

      tb = New TextBlock()
      tb.Text = "Not encrypted"
      Grid.SetColumn(tb, 1)
      Grid.SetRow(tb, 2)
      g.Children.Add(tb)

      g.ShowGridLines = True
      Me.Content = g
    End Sub

  End Class
End Namespace
WPF Set Control To Specific Row And Column In Code
16.35.Grid Operation
16.35.1.Add a ColumnDefinition to GridAdd a ColumnDefinition to Grid
16.35.2.Add a RowDefinition to GridAdd a RowDefinition to Grid
16.35.3.Clear All ColumnsClear All Columns
16.35.4.Clear All RowsClear All Rows
16.35.5.Remove One ColumnRemove One Column
16.35.6.Remove One RowRemove One Row
16.35.7.The current number of ColumnsThe current number of Columns
16.35.8.The current number of RowsThe current number of Rows
16.35.9.Remove 5 Columns with ColumnDefinitions.RemoveRangeRemove 5 Columns with ColumnDefinitions.RemoveRange
16.35.10.Remove 5 Row with RowDefinitions.RemoveRangeRemove 5 Row with RowDefinitions.RemoveRange
16.35.11.Contains RowContains Row
16.35.12.Contains Column?Contains Column?
16.35.13.Insert RowInsert Row
16.35.14.Insert ColumnInsert Column
16.35.15.Set control to specific row and column in codeSet control to specific row and column in code
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.