![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | 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) |
| | 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 | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| IM address import not populating in WLM | Live Messenger | |||
| Populating ComboBox | VB Script | |||
| Populating a combo box | PowerShell | |||
| Populating dataset crashes app without error message | .NET General | |||