wpf - Refreshing UI issue when deriving from a UserControl -
i’ve inherited usercontrol add functionality, , works great. myusercontrol in different project, , use in main project, problem anytime open xaml not render until make change , build. after layout refreshes time, if close user control , reopen not display unless build. here xaml
<cc:formusercontrol x:class="module.options.views.accounting.views.journalformview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:module.common.controls;assembly=module.common"> <textbox grid.row="1" text=”some text” /> </cc:formusercontrol>
here c#
public class formusercontrol : usercontrol, iview { public formusercontrol() { setvalue(viewmodellocator.autowireviewmodelproperty, true); } public override void endinit() { if (canrefresh) { resources.mergeddictionaries.add( new resourcedictionary().addresource("/resource.dictionaries;component/styles/mycontrolstyle.xaml")); style = findresource("mysercontrolstyle") style; } base.endinit(); } public bool canrefresh { { return (bool)getvalue(canrefreshproperty); } set { setvalue(canrefreshproperty, value); } } public static readonly dependencyproperty canrefreshproperty = dependencyproperty.register("canrefresh", typeof(bool), typeof(formusercontrol), new propertymetadata(false)); }
there nothing special code , don’t know why not refresh until buid. these 2 files in different projects, , xaml work anychange add space , build. ideas?
kind regards
after make changes usercontrol
in different project, designer figures out usercontrol
it's displaying out of date. therefore need build/rebuild solution designer can catch up , display latest changes on designer.
when build or run solution, things should okay.
Comments
Post a Comment