![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | Grid.Row Grid.Column set programatically at runtime hi, How to programatically change the Grid.Row and Grid.Column & ColumnSpan at runtime. I wanted a way to make my customer selection and shopping basket XAML frames to be vertical or horizontally configurable, depending upon how long a product's description was. Took a bit to find this so im posting it to help others as i didnt find anything myself. Assuming you only have one grid per code behind file (which is highly possible if you make your app very modular) <!--XAML initial state to have both vertical for short product names--> <!-- left --> <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="1" VerticalAlignment="Center" >Click to Add</Label> <Frame Name="SelectionFrame" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1" Margin="2"></Frame> <!-- right --> <Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="1" VerticalAlignment="Center" >Click to Remove</Label> <Frame Name="BasketFrame" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="1" Margin="2"></Frame> //c# code to move it to a horizontal position //make top horiz left selection Grid.SetColumnSpan(SelectionFrame, 2); Grid.SetColumn(SelectionFrame, 0); //make bottom horiz right basket Grid.SetColumnSpan(BasketFrame, 2); Grid.SetColumn(BasketFrame, 0); Grid.SetRow(BasketFrame, 2); craig. craig kelly-soens - Windows Vista WinFx XAML .Net Evangelist http://www.XpectWorld.com - customised "super-easy to use" Windows Vista based software & consultancy |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Grid question | Yoavo | Avalon | 1 | 09-17-2007 10:14 AM |
| WPF Grid? | john | Avalon | 8 | 11-20-2006 12:10 PM |
| WPF Grid? | john | Avalon | 0 | 11-19-2006 12:55 PM |
| Bind to a particular row and column of a dynamic grid? | Phillip M. Hoff | Avalon | 0 | 06-20-2006 12:05 AM |
| EXCEL like grid | lcantelmo@gmail.com | Avalon | 3 | 01-10-2006 03:54 PM |