c# - Strange behavior of control position in wpf -
it's strange behaviour wpf control positioning. had below controls , aligned during design time. runtime gave misaligned positioning in corner of button
<window x:class="stackoverflow.lookandwork" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="tables" height="388" width="314" resizemode="noresize" > <grid> <textbox margin="12,12,12,41"></textbox> <button content="ok" height="23" margin="205,314,12,12" name="button3" width="75" iscancel="true" isenabled="false" /> </grid> </window>
designtime snap
runtime snap
suppose if removed resizemode="noresize" window. can able see correct positioning @ runtime. problem resizemode="noresize" ?
anyhelp appreciated !!!
instead of adding margin in control level, why don't add minimum margin in grid level?
example:
<grid margin="12,12,12,12">
this way 12 pixel margin border. on button, don't hardcoded left margin. instead, can use horizontalalignment="right"
job.
on side note, less prefer add controls in grid without specifying grid.rowdefinitions, grid.columndefinitions, grid.row , grid.column. poweful tool grid.
Comments
Post a Comment