Using a UniformGrid inside of a Button control in WPF -
i want content of button control contain uniform grid. however, button control doesn't seem allow child content control stretch. uniformgrid squeezed down fit own contents. allows me set width, won't auto stretch if set horizontalalignment explicitly. missing?
<button margin="0,4,0,4"> <itemscontrol itemssource="{binding zones}" focusable="false"> <itemscontrol.itemspanel> <itemspaneltemplate> <uniformgrid columns="{binding zones.count}" /> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemtemplate> <datatemplate> <wpfapplication2:controllerzonecontrol datacontext="{binding}" /> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </button>
i can force width using following, seems hacky me.
<uniformgrid width="{binding relativesource={relativesource ancestortype={x:type button}}, path=actualwidth}" columns="{binding zones.count}" />
of things forgot try...setting button's horizontalcontentalignment stretch fix.
Comments
Post a Comment