Alternative Grid Layout for Silverlight suggestion
Posted
by brainbox
on ASP.net Weblogs
See other posts from ASP.net Weblogs
or by brainbox
Published on Tue, 20 Apr 2010 10:21:00 GMT
Indexed on
2010/04/20
10:33 UTC
Read the original article
Hit count: 403
Silverlight
|wpf
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.
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>
© ASP.net Weblogs or respective owner