Hi just trying to get my head around XAML.
Thought that I would try some writing XAML in code.
Trying to add a grid with 6 by 6 column definitions then add a textblock into one of the grid cells.
I dont seem to be able to reference the cell that I want - there is no method on the grid that I can add the textblock too. Just grid.children.add(object). No Cell definition.
TIA
The XAML
<Page x:Class="WPF_Tester.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Page1"
Loaded="Page_Loaded">
</Page>
The C# private void Page_Loaded(object sender, RoutedEventArgs e) {
//create the structure
Grid g = new Grid();
g.ShowGridLines = true;
g.Visibility = Visibility.Visible;
//add columns
for (int i = 0; i < 6; ++i)
{
ColumnDefinition cd = new ColumnDefinition();
cd.Name = "Column" + i.ToString();
g.ColumnDefinitions.Add(cd);
}
//add rows
for (int i = 0; i < 6; ++i)
{
RowDefinition rd = new RowDefinition();
rd.Name = "Row" + i.ToString();
g.RowDefinitions.Add(rd);
}
TextBlock tb = new TextBlock();
tb.Text = "Hello World";
g.Children.Add(tb);
}
update
Thanks for the answers however here is the spooky bit...
Using VS2008 Pro on XP
WPFbrowser Project Template (3.5 verified)
I dont get the methods in the autocomplete.