mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
Migrate code;widen xaml snip ref (#1279)
This commit is contained in:
+3
-3
@@ -16,12 +16,12 @@ This example shows how to use the methods in the <xref:System.Windows.Controls.C
|
||||
## Example
|
||||
The following example creates a <xref:System.Windows.Controls.Grid> element with a <xref:System.Windows.FrameworkElement.Name%2A> of `grid1`. The <xref:System.Windows.Controls.Grid> contains a <xref:System.Windows.Controls.StackPanel> that holds <xref:System.Windows.Controls.Button> elements, each controlled by a different collection method. When you click a <xref:System.Windows.Controls.Button>, it activates a method call in the code-behind file.
|
||||
|
||||
[!code-xaml[ColumnDefinitionsGrid#1](~/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml#1)]
|
||||
:::code language="xaml" source="snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml" id="Snippet1":::
|
||||
|
||||
This example defines a series of custom methods, each corresponding to a <xref:System.Windows.Controls.Primitives.ButtonBase.Click> event in the [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] file. You can change the number of columns and rows in the <xref:System.Windows.Controls.Grid> in several ways, which includes adding or removing rows and columns; and counting the total number of rows and columns. To prevent <xref:System.ArgumentOutOfRangeException> and <xref:System.ArgumentException> exceptions, you can use the error-checking functionality that the <xref:System.Windows.Controls.ColumnDefinitionCollection.RemoveRange%2A> method provides.
|
||||
|
||||
[!code-csharp[ColumnDefinitionsGrid#2](~/samples/snippets/csharp/VS_Snippets_Wpf/ColumnDefinitionsGrid/CSharp/Window1.xaml.cs#2)]
|
||||
[!code-vb[ColumnDefinitionsGrid#2](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ColumnDefinitionsGrid/VisualBasic/Window1.xaml.vb#2)]
|
||||
:::code language="csharp" source="snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/csharp/Window1.xaml.cs" id="Snippet2":::
|
||||
:::code language="vb" source="snippets/manipulate-columns-and-rows-by-using-columndefinitionscollections/vb/Window1.xaml.vb" id="Snippet2":::
|
||||
|
||||
## See also
|
||||
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="columndefinitions_grid.Window1"
|
||||
Title="ColumnDefinitions Sample">
|
||||
<Border BorderBrush="Black" Background="White" BorderThickness="2">
|
||||
<!-- <Snippet1> -->
|
||||
<DockPanel Margin="10,0,0,0">
|
||||
|
||||
<TextBlock FontSize="20" FontWeight="Bold" DockPanel.Dock="Top">Grid Column and Row Collections</TextBlock>
|
||||
<TextBlock DockPanel.Dock="Top">Click any of the buttons below to invoke the associated methods and properties of ColumnDefinition and RowDefinition Collections.</TextBlock>
|
||||
<Grid DockPanel.Dock="Top" HorizontalAlignment="Left" Name="grid1" ShowGridLines="true" Width="625" Height="400" Background="#b0e0e6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
|
||||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
|
||||
<Button Width="125" Click="addCol">Add Column</Button>
|
||||
<Button Width="125" Click="addRow">Add Row</Button>
|
||||
<Button Width="125" Click="clearCol">Clear All Columns</Button>
|
||||
<Button Width="125" Click="clearRow">Clear All Rows</Button>
|
||||
<Button Width="125" Click="removeCol">Remove One Column</Button>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
|
||||
<Button Width="125" Click="removeRow">Remove One Row</Button>
|
||||
<Button Width="125" Click="colCount">How Many Columns?</Button>
|
||||
<Button Width="125" Click="rowCount">How Many Rows?</Button>
|
||||
<Button Width="125" Click="rem5Col">Remove 5 Columns</Button>
|
||||
<Button Width="125" Click="rem5Row">Remove 5 Rows</Button>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
|
||||
<Button Width="125" Click="containsRow">Contains Row?</Button>
|
||||
<Button Width="125" Click="containsCol">Contains Column?</Button>
|
||||
<Button Width="125" Click="insertRowAt">Insert Row</Button>
|
||||
<Button Width="125" Click="insertColAt">Insert Column</Button>
|
||||
<Button Width="125" Click="colReadOnly">IsReadOnly?</Button>
|
||||
</StackPanel>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp1"/>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp2"/>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp3"/>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp4"/>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp5"/>
|
||||
</DockPanel>
|
||||
<!-- </Snippet1> -->
|
||||
</Border>
|
||||
</Window>
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
// <Snippet2>
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
|
||||
namespace columndefinitions_grid
|
||||
{
|
||||
public partial class Window1 : Window
|
||||
{
|
||||
RowDefinition rowDef1;
|
||||
ColumnDefinition colDef1;
|
||||
|
||||
// <Snippet11>
|
||||
private void addCol(object sender, RoutedEventArgs e)
|
||||
{
|
||||
colDef1 = new ColumnDefinition();
|
||||
grid1.ColumnDefinitions.Add(colDef1);
|
||||
}
|
||||
//</Snippet11>
|
||||
|
||||
// <Snippet3>
|
||||
private void addRow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rowDef1 = new RowDefinition();
|
||||
grid1.RowDefinitions.Add(rowDef1);
|
||||
}
|
||||
//</Snippet3>
|
||||
|
||||
// <Snippet12>
|
||||
private void clearCol(object sender, RoutedEventArgs e)
|
||||
{
|
||||
grid1.ColumnDefinitions.Clear();
|
||||
}
|
||||
//</Snippet12>
|
||||
|
||||
// <Snippet4>
|
||||
private void clearRow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
grid1.RowDefinitions.Clear();
|
||||
}
|
||||
//</Snippet4>
|
||||
|
||||
// <Snippet15>
|
||||
private void removeCol(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (grid1.ColumnDefinitions.Count <= 0)
|
||||
{
|
||||
tp1.Text = "No More Columns to Remove!";
|
||||
}
|
||||
else
|
||||
{
|
||||
grid1.ColumnDefinitions.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
//</Snippet15>
|
||||
|
||||
// <Snippet5>
|
||||
private void removeRow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (grid1.RowDefinitions.Count <= 0)
|
||||
{
|
||||
tp1.Text = "No More Rows to Remove!";
|
||||
}
|
||||
else
|
||||
{
|
||||
grid1.RowDefinitions.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
//</Snippet5>
|
||||
|
||||
// <Snippet17>
|
||||
private void colCount(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tp2.Text = "The current number of Columns is: " + grid1.ColumnDefinitions.Count;
|
||||
}
|
||||
//</Snippet17>
|
||||
|
||||
// <Snippet7>
|
||||
private void rowCount(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tp2.Text = "The current number of Rows is: " + grid1.RowDefinitions.Count;
|
||||
}
|
||||
//</Snippet7>
|
||||
|
||||
// <Snippet16>
|
||||
private void rem5Col(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (grid1.ColumnDefinitions.Count < 5)
|
||||
{
|
||||
tp1.Text = "There aren't five Columns to Remove!";
|
||||
}
|
||||
else
|
||||
{
|
||||
grid1.ColumnDefinitions.RemoveRange(0,5);
|
||||
}
|
||||
}
|
||||
// </Snippet16>
|
||||
|
||||
// <Snippet6>
|
||||
private void rem5Row(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (grid1.RowDefinitions.Count < 5)
|
||||
{
|
||||
tp1.Text = "There aren't five Rows to Remove!";
|
||||
}
|
||||
else
|
||||
{
|
||||
grid1.RowDefinitions.RemoveRange(0, 5);
|
||||
}
|
||||
}
|
||||
//</Snippet6>
|
||||
|
||||
// <Snippet8>
|
||||
private void containsRow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (grid1.RowDefinitions.Contains(rowDef1))
|
||||
{
|
||||
tp2.Text = "Grid Contains RowDefinition rowDef1";
|
||||
}
|
||||
else
|
||||
{
|
||||
tp2.Text = "Grid Does Not Contain RowDefinition rowDef1";
|
||||
}
|
||||
}
|
||||
//</Snippet8>
|
||||
|
||||
// <Snippet13>
|
||||
private void containsCol(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (grid1.ColumnDefinitions.Contains(colDef1))
|
||||
{
|
||||
tp3.Text = "Grid Contains ColumnDefinition colDef1";
|
||||
}
|
||||
else
|
||||
{
|
||||
tp3.Text = "Grid Does Not Contain ColumnDefinition colDef1";
|
||||
}
|
||||
}
|
||||
//</Snippet13>
|
||||
|
||||
// <Snippet10>
|
||||
private void colReadOnly(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tp4.Text = "RowDefinitionsCollection IsReadOnly?: " + grid1.RowDefinitions.IsReadOnly.ToString();
|
||||
tp5.Text = "ColumnDefinitionsCollection IsReadOnly?: " + grid1.ColumnDefinitions.IsReadOnly.ToString();
|
||||
}
|
||||
//</Snippet10>
|
||||
|
||||
// <Snippet9>
|
||||
private void insertRowAt(object sender, RoutedEventArgs e)
|
||||
{
|
||||
rowDef1 = new RowDefinition();
|
||||
grid1.RowDefinitions.Insert(grid1.RowDefinitions.Count, rowDef1);
|
||||
tp1.Text = "RowDefinition added at index position " + grid1.RowDefinitions.IndexOf(rowDef1).ToString();
|
||||
}
|
||||
//</Snippet9>
|
||||
|
||||
// <Snippet14>
|
||||
private void insertColAt(object sender, RoutedEventArgs e)
|
||||
{
|
||||
colDef1 = new ColumnDefinition();
|
||||
grid1.ColumnDefinitions.Insert(grid1.ColumnDefinitions.Count, colDef1);
|
||||
tp2.Text = "ColumnDefinition added at index position " + grid1.ColumnDefinitions.IndexOf(colDef1).ToString();
|
||||
}
|
||||
//</Snippet14>
|
||||
}
|
||||
}
|
||||
//</Snippet2>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<Application
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="columndefinitions_grid.app"
|
||||
Startup="AppStartingUp"
|
||||
/>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Data;
|
||||
using System.Xml;
|
||||
using System.Configuration;
|
||||
|
||||
namespace columndefinitions_grid
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for app.xaml
|
||||
/// </summary>
|
||||
|
||||
public partial class app : Application
|
||||
{
|
||||
void AppStartingUp(object sender, StartupEventArgs e)
|
||||
{
|
||||
Window1 mainWindow = new Window1();
|
||||
mainWindow.InitializeComponent();
|
||||
mainWindow.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>SDKSample</AssemblyName>
|
||||
<TargetType>winexe</TargetType>
|
||||
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
<ProjectGuid>{4BDD3A99-C878-405A-9108-7C948EA50659}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="app.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Window1.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="app.xaml.cs">
|
||||
<DependentUpon>app.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Window1.xaml.cs">
|
||||
<DependentUpon>Window1.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"host": "visualstudio"
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>SDKSample</AssemblyName>
|
||||
<TargetType>winexe</TargetType>
|
||||
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
<ProjectGuid>{9CD74B47-FC44-43A0-B18E-FFF7B4EA3EF8}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="app.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Window1.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Window1.xaml.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.Window1"
|
||||
Title="ColumnDefinitions Sample">
|
||||
<Border BorderBrush="Black" Background="White" BorderThickness="2">
|
||||
<DockPanel Margin="10,0,0,0">
|
||||
|
||||
<TextBlock FontSize="20" FontWeight="Bold" DockPanel.Dock="Top">Grid Column and Row Collections</TextBlock>
|
||||
<TextBlock DockPanel.Dock="Top">Click any of the buttons below to invoke the associated methods and properties of ColumnDefinition and RowDefinition Collections.</TextBlock>
|
||||
|
||||
<Grid DockPanel.Dock="Top" HorizontalAlignment="Left" Name="grid1" ShowGridLines="True" Width="625" Height="400" Background="#b0e0e6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
|
||||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
|
||||
<Button Width="125" Click="addCol">Add Column</Button>
|
||||
<Button Width="125" Click="addRow">Add Row</Button>
|
||||
<Button Width="125" Click="clearCol">Clear All Columns</Button>
|
||||
<Button Width="125" Click="clearRow">Clear All Rows</Button>
|
||||
<Button Width="125" Click="removeCol">Remove One Column</Button>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
|
||||
<Button Width="125" Click="removeRow">Remove One Row</Button>
|
||||
<Button Width="125" Click="colCount">How Many Columns?</Button>
|
||||
<Button Width="125" Click="rowCount">How Many Rows?</Button>
|
||||
<Button Width="125" Click="rem5Col">Remove 5 Columns</Button>
|
||||
<Button Width="125" Click="rem5Row">Remove 5 Rows</Button>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Width="625" DockPanel.Dock="Top">
|
||||
<Button Width="125" Click="containsRow">Contains Row?</Button>
|
||||
<Button Width="125" Click="containsCol">Contains Column?</Button>
|
||||
<Button Width="125" Click="insertRowAt">Insert Row</Button>
|
||||
<Button Width="125" Click="insertColAt">Insert Column</Button>
|
||||
<Button Width="125" Click="colReadOnly">IsReadOnly?</Button>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp1"/>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp2"/>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp3"/>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp4"/>
|
||||
<TextBlock DockPanel.Dock="Top" Name="tp5"/>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Window>
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
' <Snippet2>
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Documents
|
||||
|
||||
Namespace SDKSample
|
||||
|
||||
'@ <summary>
|
||||
'@ Interaction logic for Window1.xaml
|
||||
'@ </summary>
|
||||
|
||||
Partial Public Class Window1
|
||||
Inherits Window
|
||||
|
||||
Dim rowDef1 As New RowDefinition
|
||||
Dim colDef1 As New ColumnDefinition
|
||||
|
||||
' <Snippet11>
|
||||
Private Sub addCol(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
Dim colDef1 As New ColumnDefinition
|
||||
grid1.ColumnDefinitions.Add(colDef1)
|
||||
End Sub
|
||||
' </Snippet11>
|
||||
|
||||
'<Snippet3>
|
||||
Private Sub addRow(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
Dim rowDef1 As New RowDefinition()
|
||||
grid1.RowDefinitions.Add(rowDef1)
|
||||
End Sub
|
||||
'</Snippet3>
|
||||
|
||||
'<Snippet12>
|
||||
Private Sub clearCol(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
grid1.ColumnDefinitions.Clear()
|
||||
End Sub
|
||||
'</Snippet12>
|
||||
|
||||
'<Snippet4>
|
||||
Private Sub clearRow(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
grid1.RowDefinitions.Clear()
|
||||
End Sub
|
||||
'</Snippet4>
|
||||
|
||||
'<Snippet15>
|
||||
Private Sub removeCol(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
|
||||
If (grid1.ColumnDefinitions.Count <= 0) Then
|
||||
tp1.Text = "No More Columns to Remove!"
|
||||
Else
|
||||
grid1.ColumnDefinitions.RemoveAt(0)
|
||||
End If
|
||||
End Sub
|
||||
'</Snippet15>
|
||||
|
||||
'<Snippet5>
|
||||
Private Sub removeRow(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
If (grid1.RowDefinitions.Count <= 0) Then
|
||||
tp1.Text = "No More Rows to Remove!"
|
||||
Else
|
||||
grid1.RowDefinitions.RemoveAt(0)
|
||||
End If
|
||||
End Sub
|
||||
'</Snippet5>
|
||||
|
||||
'<Snippet17>
|
||||
Private Sub colCount(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
tp2.Text = "The current number of Columns is: " + grid1.ColumnDefinitions.Count.ToString()
|
||||
End Sub
|
||||
'</Snippet17>
|
||||
|
||||
'<Snippet7>
|
||||
Private Sub rowCount(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
tp2.Text = "The current number of Rows is: " + grid1.RowDefinitions.Count.ToString()
|
||||
End Sub
|
||||
'</Snippet7>
|
||||
|
||||
'<Snippet16>
|
||||
Private Sub rem5Col(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
If (grid1.ColumnDefinitions.Count < 5) Then
|
||||
tp1.Text = "There aren't five Columns to Remove!"
|
||||
Else
|
||||
grid1.ColumnDefinitions.RemoveRange(0, 5)
|
||||
End If
|
||||
End Sub
|
||||
'</Snippet16>
|
||||
|
||||
'<Snippet6>
|
||||
Private Sub rem5Row(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
If (grid1.RowDefinitions.Count < 5) Then
|
||||
tp1.Text = "There aren't five Rows to Remove!"
|
||||
Else
|
||||
grid1.RowDefinitions.RemoveRange(0, 5)
|
||||
End If
|
||||
End Sub
|
||||
'</Snippet6>
|
||||
|
||||
'<Snippet8>
|
||||
Private Sub containsRow(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
If (grid1.RowDefinitions.Contains(rowDef1)) Then
|
||||
tp2.Text = "Grid Contains RowDefinition rowDef1"
|
||||
Else
|
||||
tp2.Text = "Grid Does Not Contain RowDefinition rowDef1"
|
||||
End If
|
||||
End Sub
|
||||
'</Snippet8>
|
||||
|
||||
'<Snippet13>
|
||||
Private Sub containsCol(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
If (grid1.ColumnDefinitions.Contains(colDef1)) Then
|
||||
tp3.Text = "Grid Contains ColumnDefinition colDef1"
|
||||
Else
|
||||
tp3.Text = "Grid Does Not Contain ColumnDefinition colDef1"
|
||||
End If
|
||||
End Sub
|
||||
'</Snippet13>
|
||||
|
||||
'<Snippet10>
|
||||
Private Sub colReadOnly(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
tp4.Text = "RowDefinitionsCollection IsReadOnly?: " + grid1.RowDefinitions.IsReadOnly.ToString()
|
||||
tp5.Text = "ColumnDefinitionsCollection IsReadOnly?: " + grid1.ColumnDefinitions.IsReadOnly.ToString()
|
||||
End Sub
|
||||
'</Snippet10>
|
||||
|
||||
'<Snippet9>
|
||||
Private Sub insertRowAt(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
Dim rowDef1 As New RowDefinition
|
||||
grid1.RowDefinitions.Insert(grid1.RowDefinitions.Count, rowDef1)
|
||||
tp1.Text = "RowDefinition added at index position " + grid1.RowDefinitions.IndexOf(rowDef1).ToString()
|
||||
End Sub
|
||||
'</Snippet9>
|
||||
|
||||
'<Snippet14>
|
||||
Private Sub insertColAt(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
Dim colDef1 As New ColumnDefinition()
|
||||
grid1.ColumnDefinitions.Insert(grid1.ColumnDefinitions.Count, colDef1)
|
||||
tp2.Text = "ColumnDefinition added at index position " + grid1.ColumnDefinitions.IndexOf(colDef1).ToString()
|
||||
End Sub
|
||||
'</Snippet14>
|
||||
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
' </Snippet2>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<!-- This section defines the logging configuration for My.Application.Log -->
|
||||
<source name="DefaultSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog"/>
|
||||
<!-- Uncomment the below section to write to the Application Event Log -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information"/>
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
|
||||
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
</system.diagnostics>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<Application
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="Window1.xaml"/>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"host": "visualstudio"
|
||||
}
|
||||
Reference in New Issue
Block a user