xaml - WPF disable ListBox autosizing in uniform grid -
i have following structure:
<uniformgrid horizontalalignment="stretch" grid.row="0" verticalalignment="top" columns="6" dockpanel.dock="right" > <stackpanel horizontalalignment="stretch"> <dockpanel background="#ff393939" > <label content="{lex:loc site}" foreground="#ffe0e0e0"/> </dockpanel> <listbox height="300" itemssource="{binding sites.view}" displaymemberpath="name.actualtranslation"> </listbox> </stackpanel>...
these stackpanels in uniformgrid should spreaded on whole mainwindow (or view)... still if there item in listbox has longer string needs more place standard width autofits string , have scroll vertically.
i dont want listview gain width if content has not enough place. have scrollviewer in mainwindow in view placed...
what can uniform grid stays same width mainwindow-...
i've tried give name mainwindow , bind width this: width="{binding elementname=mainwindow, path=actualwdith}"
..
though error:
cannot find source binding reference 'elementname=mainwindow'. bindingexpression:path=actualwdith; dataitem=null;
what can fix issue? if need more information or error description isnt clear dont hesitate ask.
update: how should be:
behavior when text long: , scrollbar appears on bottom..
if trying access wpf object name needs have x:key="name"
wasn't shown in code above, i.e.
<window x:name="mainwindow" ....
alternatively can walk tree until find object of correct type,
width="{binding relativesource={relativesource findancestor, ancestortype={x:type mainwindow}, path=actualwidth}"
Comments
Post a Comment