![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | 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 |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| wpf data grid | .NET General | |||