c# - Wpf expander in listview -
i have list view expander in it. possible make expanding on screen?
<grid> <listview itemssource="{binding items}"> <listview.itemtemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> </grid.columndefinitions> <grid.rowdefinitions> <rowdefinition></rowdefinition> </grid.rowdefinitions> <expander grid.column="6" grid.row="0" margin="41.343,0,-27,0"> <stackpanel> <label content="first element"/> <label content="second element"/> <label content="third element"/> </stackpanel> </expander> <label grid.column="0" grid.row="0" content="test"/> <label grid.column="1" grid.row="0" content="test"/> <label grid.column="2" grid.row="0" content="220.35"/> <label grid.column="3" grid.row="0" content="15.37"/> <label grid.column="4" grid.row="0" content="4.54"/> <label grid.column="5" grid.row="0" content="00:04:01"/> </grid> </datatemplate> </listview.itemtemplate> </listview> </grid>
i tried place "first element","second element","third eletment" in grid , change expanding size, xaml not allow place left border of grid left of expander left border.
the following code should work basis, need tweak rest fit specific requirements, did add additional row expander can sit in row , expand left rowspaning entire length of grid columns.
<grid> <grid.columndefinitions> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> </grid.columndefinitions> <grid.rowdefinitions> <rowdefinition></rowdefinition> <rowdefinition></rowdefinition> </grid.rowdefinitions> <expander expanddirection="left" grid.columnspan="6" grid.row="1" margin="41.343,0,-27,0"> <stackpanel orientation="horizontal"> <label content="first element"/> <label content="second element"/> <label content="third element"/> </stackpanel> </expander> <label grid.column="0" grid.row="0" content="test"/> <label grid.column="1" grid.row="0" content="test"/> <label grid.column="2" grid.row="0" content="220.35"/> <label grid.column="3" grid.row="0" content="15.37"/> <label grid.column="4" grid.row="0" content="4.54"/> <label grid.column="5" grid.row="0" content="00:04:01"/> </grid>
Comments
Post a Comment