![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |