Horizontal scroll bar problem in silverlight data grid -
i'm using silverlight 4 datagrid. have datagridtextcolumn , datagrid template column, them i'm specifying column in '*', 'sizetoheader'.
everything works fine if have 20 records in datagrid, if grid have more 30 records, it's behaving odd. it's column headers , columns not aligned, due improper alignment, horizontal appears unnecessarily, if click of column header, ok. alignment of column header columns.
this happening me.
in case, moment set template rows, this:
<style targettype="sdk:datagridrow"> <setter property="istabstop" value="true" /> <setter property="template"> <setter.value> <controltemplate targettype="sdk:datagridrow"> <localprimitives:datagridfrozengrid name="root"> <vsm:visualstatemanager.visualstategroups> <vsm:visualstategroup x:name="commonstates"> <vsm:visualstategroup.transitions> <vsm:visualtransition generatedduration="0" /> </vsm:visualstategroup.transitions> <vsm:visualstate x:name="normal" /> <vsm:visualstate x:name="normal alternatingrow"> <storyboard> <doubleanimation storyboard.targetname="backgroundrectangle" storyboard.targetproperty="opacity" duration="0" to="0"/> </storyboard> </vsm:visualstate> <vsm:visualstate x:name="mouseover"> <storyboard> <doubleanimation storyboard.targetname="backgroundrectangle" storyboard.targetproperty="opacity" duration="0" to=".65"/> <coloranimationusingkeyframes begintime="0" duration="0" storyboard.targetname="backgroundrectangle" storyboard.targetproperty="(shape.fill).(solidcolorbrush.color)"> <splinecolorkeyframe keytime="0" value="#666666"/> </coloranimationusingkeyframes> </storyboard> </vsm:visualstate> <vsm:visualstate x:name="normal selected"> <storyboard> <doubleanimation storyboard.targetname="backgroundrectangle" storyboard.targetproperty="opacity" duration="0" to="5"/> <coloranimationusingkeyframes begintime="0" duration="0" storyboard.targetname="backgroundrectangle" storyboard.targetproperty="(shape.fill).(solidcolorbrush.color)"> <splinecolorkeyframe keytime="0" value="#ddddff"/> </coloranimationusingkeyframes> <objectanimationusingkeyframes begintime="00:00:00" duration="00:00:00.0010000" storyboard.targetname="contentcontrol" storyboard.targetproperty="(control.fontweight)"> <discreteobjectkeyframe keytime="00:00:00"> <discreteobjectkeyframe.value> <fontweight>bold</fontweight> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> </storyboard> </vsm:visualstate> <vsm:visualstate x:name="mouseover selected" > <storyboard> <doubleanimation storyboard.targetname="backgroundrectangle" storyboard.targetproperty="opacity" duration="50" to="1"/> <coloranimationusingkeyframes begintime="0" duration="50" storyboard.targetname="backgroundrectangle" storyboard.targetproperty="(shape.fill).(solidcolorbrush.color)"> <splinecolorkeyframe keytime="0" value="#ccccff"/> </coloranimationusingkeyframes> <objectanimationusingkeyframes begintime="00:00:00" duration="00:00:00.0010000" storyboard.targetname="contentcontrol" storyboard.targetproperty="(control.fontweight)"> <discreteobjectkeyframe keytime="00:00:00"> <discreteobjectkeyframe.value> <fontweight>bold</fontweight> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> </storyboard> </vsm:visualstate> <vsm:visualstate x:name="unfocused selected"> <storyboard> <doubleanimation storyboard.targetname="backgroundrectangle" storyboard.targetproperty="opacity" duration="0" to="1"/> <coloranimationusingkeyframes begintime="0" duration="0" storyboard.targetname="backgroundrectangle" storyboard.targetproperty="(shape.fill).(solidcolorbrush.color)"> <splinecolorkeyframe keytime="0" value="lightgray"/> </coloranimationusingkeyframes> <objectanimationusingkeyframes begintime="00:00:00" duration="00:00:00.0010000" storyboard.targetname="contentcontrol" storyboard.targetproperty="(control.fontweight)"> <discreteobjectkeyframe keytime="00:00:00"> <discreteobjectkeyframe.value> <fontweight>bold</fontweight> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> </storyboard> </vsm:visualstate> </vsm:visualstategroup> </vsm:visualstatemanager.visualstategroups> <grid.rowdefinitions> <rowdefinition height="*"> </rowdefinition> <rowdefinition height="auto"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition width="*" /> </grid.columndefinitions> <!--<grid.resources> <storyboard x:key="detailsvisibletransition"> <doubleanimation storyboard.targetname="detailspresenter" storyboard.targetproperty="contentheight" duration="00:00:0.1" /> </storyboard> </grid.resources>--> <border x:name="borda" borderbrush="black" borderthickness="0,1,0,0" ></border> <rectangle x:name="backgroundrectangle" grid.rowspan="2" grid.columnspan="2" opacity="0" fill="#1ca0f2" > </rectangle> <contentcontrol x:name="contentcontrol" fontsize="12" > <localprimitives:datagridcellspresenter grid.column="1" name="cellspresenter" localprimitives:datagridfrozengrid.isfrozen="true" > </localprimitives:datagridcellspresenter> </contentcontrol> <localprimitives:datagridrowheader grid.rowspan="3" name="rowheader" localprimitives:datagridfrozengrid.isfrozen="true" /> <localprimitives:datagriddetailspresenter grid.row="1" grid.column="1" name="detailspresenter" /> <rectangle grid.row="2" grid.column="1" name="bottomgridline" horizontalalignment="stretch" height="1" /> </localprimitives:datagridfrozengrid> </controltemplate> </setter.value> </setter> </style>
i odd behavior, everytime have horizontal scrollbars available, , use it, headers disaligned cells of rows.
for while, working me if take customization of grid (the codeblock above) application, however, loose visual styles, don't want. if have it, , not need much, could try removing too.
regards!
clayton freitas
Comments
Post a Comment