Version

ColumnWidth Property (XamGrid)

Gets/Sets the Width that will be applied to every Column in the XamGrid
Syntax
'Declaration
 
Public Property ColumnWidth As ColumnWidth
public ColumnWidth ColumnWidth {get; set;}
Example
Using the xamGrid control's ColumnWidth property along with an instace of the ColumnWidth object, you can change the width that will be applied to every column in xamGrid.

' Columns will size to the value specified. Otherwise columns will size to a percent value 
' compared to all other columns with the Star ColumnWidthType 
xamGrid.ColumnWidth = New ColumnWidth(40, False)     ' or 
xamGrid.ColumnWidth = New ColumnWidth(2, True)

' Set the column width property to the static instance of InitialAuto ColumnWidth value. If this technique is 
' used, all columns will size to the largest header or cell in the column. However, this will only occur when 
' the grid first loads or when a user double clicks on the edge of a column header to resize. 
xamGrid.ColumnWidth = ColumnWidthType.InitialAuto

' Set the column width property to the static instance of Auto ColumnWidth. If this technique is used, all columns 
' will size to the largest header or cell in the column. While scrolling, the width of the column may grow as larger 
' content comes into view, however, it will never decrease in width. 
xamGrid.ColumnWidth = ColumnWidthType.Auto 

' Set the column width property to the static instance of SizeToCells ColumnWidth value. If this technique is used, 
' all columns will size to the largest cell in the column. While scrolling, the width of the column may grow as larger 
' content comes into view, however, it will never decrease in width. 
xamGrid.ColumnWidth = ColumnWidthType.SizeToCells

' Set the column width property to the static instance of SizeToHeader ColumnWidth value. If this technique is used, 
' all columns will size to the header of a column. 
xamGrid.ColumnWidth = ColumnWidthType.SizeToHeader

' Set the column width property to the static instance of Star ColumnWidth which is equlvalant to passing values of 1 
' and True to ColumnWidth constructor. If this technique is used, all columns will size to fill any remaining space in 
' the xamGrid. If more than one column has a star value specified, the remaining width will be split evenly amongst 
' the columns. If other columns already are taking up the majority of the space, the column's width will be zero. 
' If the xamGrid control's width is Infinity, then the column will act as an Auto ColumnWidthType width. 
xamGrid.ColumnWidth = ColumnWidthType.Star         ' same as:
xamGrid.ColumnWidth = New ColumnWidth(1, True)
// Columns will size to the value specified. Otherwise columns will size to a percent value 
// compared to all other columns with the Star ColumnWidthType 
xamGrid.ColumnWidth = new ColumnWidth (40, false);   // or 
xamGrid.ColumnWidth = new ColumnWidth (2, true);


// Set the column width property to the static instance of InitialAuto ColumnWidth value. If this technique is 
// used, all columns will size to the largest header or cell in the column. However, this will only occur when 
// the grid first loads or when a user double clicks on the edge of a column header to resize. 
xamGrid.ColumnWidth = ColumnWidthType.InitialAuto;

// Set the column width property to the static instance of Auto ColumnWidth. If this technique is used, all columns 
// will size to the largest header or cell in the column. While scrolling, the width of the column may grow as larger 
// content comes into view, however, it will never decrease in width. 
xamGrid.ColumnWidth = ColumnWidthType.Auto;

// Set the column width property to the static instance of SizeToCells ColumnWidth value. If this technique is used, 
// all columns will size to the largest cell in the column. While scrolling, the width of the column may grow as larger 
// content comes into view, however, it will never decrease in width. 
xamGrid.ColumnWidth = ColumnWidthType.SizeToCells;

// Set the column width property to the static instance of SizeToHeader ColumnWidth value. If this technique is used, 
// all columns will size to the header of a column. 
xamGrid.ColumnWidth = ColumnWidthType. SizeToHeader;

// Set the column width property to the static instance of Star ColumnWidth which is equlvalant to passing values of 1 
// and True to ColumnWidth constructor. If this technique is used, all columns will size to fill any remaining space in 
// the xamGrid. If more than one column has a star value specified, the remaining width will be split evenly amongst 
// the columns. If other columns already are taking up the majority of the space, the column's width will be zero. 
// If the xamGrid control's width is Infinity, then the column will act as an Auto ColumnWidthType width. 
xamGrid.ColumnWidth = ColumnWidthType.Star;        // same as:
xamGrid.ColumnWidth = new ColumnWidth (1, true);
<!-- Columns will size to the value specified. Otherwise columns will size to a percent value 
 compared to all other columns with the Star ColumnWidthType 
-->
<ig:XamGrid x:Name="xamGrid" ColumnWidth="40">
   
<!-- ... -->
</ig:XamGrid>       

<ig:XamGrid x:Name="xamGrid" ColumnWidth="2*" 
   
<!-- ... -->
</ig:XamGrid>

<!
-- Set the column width property to the static instance of InitialAuto ColumnWidth value. If this technique is 
   used, all columns will size to the largest header or cell in the column. However, this will only occur when 
   the grid first loads or when a user double clicks on the edge of a column header to resize. -->
<ig:XamGrid x:Name="xamGrid" ColumnWidth="InitialAuto">
   <!-- ... -->
</ig:XamGrid>

<!-- S
et the column width property to the static instance of Auto ColumnWidth. If this technique is used, all columns 
   will size to the largest header or cell in the column. While scrolling, the width of the column may grow as larger 
   content comes into view, however, it will never decrease in width. -->
<ig:XamGrid x:Name="xamGrid" ColumnWidth="Auto">
   <!-- ... -->
</ig:XamGrid>

<!-- Set the column width property to the static instance of SizeToCells ColumnWidth value. I
f this technique is used, 
   all columns wi
ll size to the largest cell in the column. While scrolling, the width of the column may grow as larger 
   content comes into view, however, it will never decrease in width. -->
<ig:XamGrid x:Name="xamGrid" ColumnW
idth="SizeToCells">
   
<!-- ... -->
</ig:XamGrid>

<!-- Set the column width property to the static instance of SizeToHeader ColumnWidth value. If this technique is used, 
   all columns will size to the header of a column. 
-->
<ig:XamGrid x:Name="xamGrid" ColumnWidth="SizeToHeader">
   
<!-- ... -->
</ig:XamGrid>

<!-- Set the column width property to the static instance of Star ColumnWidth which is equlvalant to passing values of 1 
   and True to ColumnWidth constructor. If this technique is used, all columns will size to fill any remaining space in 
   the xamGrid. If more than one column has a star value specified, the remaining width will be split evenly amongst 
   the columns. If other columns already are taking up the majority of the space, the column's width will be zero. 
   If the xamGrid control's width is Infinity, then the column will act as an Auto ColumnWidthType width. 
-->
<ig:XamGrid x:Name="xamGrid" ColumnWidth="Star"
</ig:XamGrid>
   <!-- same as: -->

<ig:XamGrid x:Name="xamGrid" ColumnWidth="1*"
</
ig:XamGrid>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also