I saw the light Alternative Grid Layout for Silverlight suggestion - Alexey Zakharov's Blog

Alternative Grid Layout for Silverlight suggestion

I've proposed a suggestion to create alternative grid layout for Silverlight. Please vote for it if also faced the same problems.

As i write before current Silverlight Grid Layout breakes best practices of HTML and Adobe Flex Grid layouts. Current defention based approach have following disadvantages that makes xaml coding very hard:

1. It is very hard to create new row. In that case you should rewrite
all Grid.Row and Grid.Columns for all rows inserted below.
2. Defenitions are static by their nature and because of it, it is
impossible to use grid for dynamic forms. Currently even in toolkit DataForm
Microsoft is using StackPanel. But StackPanel is not designed for multi
column layout that have dataform.
3. It is impossible to use Grid as ItemsPanel for ItemsControl

Here is a sample code of AdobeFlex datagrid, which incorporates best
practices of HTML.

<mx:Grid id="myGrid">

       <!-- Define Row 1. -->
       <mx:GridRow id="row1">
           <!-- Define the first cell of Row 1. -->
           <mx:GridItem>
               <mx:Button label="Button 1"/>
           </mx:GridItem>
           <!-- Define the second cell of Row 1. -->
           <mx:GridItem>
               <mx:Button label="2"/>
           </mx:GridItem>
           <!-- Define the third cell of Row 1. -->
           <mx:GridItem>
               <mx:Button label="Button 3"/>
           </mx:GridItem>
       </mx:GridRow>

       <!-- Define Row 2. -->
       <mx:GridRow id="row2">
           <!-- Define a single cell to span three columns of Row 2. -->
           <mx:GridItem colSpan="3" horizontalAlign="center">
               <mx:Button label="Long-Named Button 4"/>
           </mx:GridItem>
       </mx:GridRow>

       <!-- Define Row 3. -->
       <mx:GridRow id="row3">
           <!-- Define an empty first cell of Row 3. -->
           <mx:GridItem/>
           <!-- Define a cell to span columns 2 and 3 of Row 3. -->
           <mx:GridItem colSpan="2" horizontalAlign="center">
               <mx:Button label="Button 5"/>
           </mx:GridItem>
       </mx:GridRow>

   </mx:Grid>

kick it on DotNetKicks.com
Published Tuesday, April 20, 2010 4:21 PM by brainbox
Filed under: ,

Comments

# re: Alternative Grid Layout for Silverlight suggestion

Wednesday, April 21, 2010 9:36 AM by brainbox

Yes. ItemsControl should work perfectly with it.