Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Populating a grid programmatically

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-31-2006   #1 (permalink)
Griff
Guest


 

Populating a grid programmatically

I'm generating on onscreen keyboard (for an industrial touchscreen app) and
it should clearly be based on a grid with buttons.

It is crying out to be populated from code, not markup, but I cannot find
any examples or documentation regarding how to add content to a specific cell
in the grid layout, with specific rowspan etc.

Any weblinks or other hints much appreciated.

--
Griff
(trying to make an industrial UI with XAML/WPF/c#)

My System SpecsSystem Spec
Old 01-31-2006   #2 (permalink)
Griff
Guest


 

RE: Populating a grid programmatically

OK, the answer was under my nose in this forum !

For anyone interested.

(assuming x:Name="myGrid" in markup)

// add rows to grid (it's the same deal for columns too)
for (int row=0;row < numRows; row++)
{
myGrid=RowDefinitions.Add(new RowDefinition());
}

(I'd be interested to see if there is a slicker way of doing this bit. )


// Stick a control in intended location

b = new Button();

myGrid.Children.Add(b);
Grid.SetRow(b,1); // 2nd row
Grid.SetColumn(b,3); // 4th column
Grid.SetColumnSpan(b,2);

b.Style = (Style)FindResource("myButtonStyle"); // defined in MyApp.xaml


As with all these things, seems obvious afterwards

--
Griff
(trying to make an industrial UI with XAML/WPF/c#)


"Griff" wrote:

> I'm generating on onscreen keyboard (for an industrial touchscreen app) and
> it should clearly be based on a grid with buttons.
>
> It is crying out to be populated from code, not markup, but I cannot find
> any examples or documentation regarding how to add content to a specific cell
> in the grid layout, with specific rowspan etc.
>
> Any weblinks or other hints much appreciated.
>
> --
> Griff
> (trying to make an industrial UI with XAML/WPF/c#)

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating a combo box Philip Colmer PowerShell 2 08-14-2008 05:16 AM
Populating dataset crashes app without error message minima producciones .NET General 1 07-30-2008 01:05 PM
populating two dimensional array with excel data Mecha77 VB Script 6 07-24-2008 09:02 AM
Vista : Start Menu : Recently Used Programs no populating Tod Bloxham Vista General 2 08-28-2007 02:20 PM
Grid.Row Grid.Column set programatically at runtime craig kelly-soens www.XpectWorld.com Avalon 0 01-10-2006 03:52 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51