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:
-54
@@ -1,54 +0,0 @@
|
||||
<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">
|
||||
<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>
|
||||
<!-- <Snippet1> -->
|
||||
<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>
|
||||
<!-- </Snippet1> -->
|
||||
<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>
|
||||
-169
@@ -1,169 +0,0 @@
|
||||
// <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>
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
<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
@@ -1,22 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>SDKSample</AssemblyName>
|
||||
<TargetType>winexe</TargetType>
|
||||
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
</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>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user