wpf 4.5 - WPF Window Top property Won't Change -
i upgraded wpf app target framework 3.5 4.5 , code setting top
property stopped working, won't change top value:
this.top=45;
it stay previous value, never changed 45.
don't have type of animations.
why behaving this?
window xaml
<window x:class="salesorderlib.salesorderinquiry" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:datepicker="clr-namespace:microsoft.windows.controls;assembly=wpftoolkit" xmlns:ui="clr-namespace:salesorderlib.resources.ui" xmlns:local="clr-namespace:salesorderlib" xmlns:global="clr-namespace:salesorderlib.common" xmlns:validation="clr-namespace:salesorderlib.validationrules" background="{dynamicresource winbackgroundbrush}" icon="resources/images/toolbar/orderinquiry.png" title="sales order - inquiry mode" height="630" width="1024" windowstate="normal" showintaskbar="true" resizemode="canresize" windowstyle="singleborderwindow" windowstartuplocation="manual" focusmanager.focusedelement="{binding elementname=txtorderno}" loaded="window_loaded" contentrendered="window_contentrendered" gotfocus="window_gotfocus" closing="window_closing" locationchanged="window_locationchanged" activated="window_activated">
here try set top property in code behind:
private void window_locationchanged(object sender, eventargs e) { try { if (this.top < 55d) this.top = 55d; if (this.height > 120d) this.lstboxmediano.height = (this.height - 120d); //set mediano popup height. thread.sleep(25); //allow window refresh. } catch (exception ex) { log.error(string.format(globalresources.msgexception, ex.tostring(), gettype().name, methodbase.getcurrentmethod().name)); messagebox.show(ex.message, globalresources.error, messageboxbutton.ok, messageboximage.error); } }
are sure windowstartuplocation
set manual
? that's reason why shouldn't respect code.
Comments
Post a Comment