c# - DependencyProperty of Custom Type won't fire propertychanged callback -


premise: read others threads similar issues none of solved problem.

i have usercontrol (summarysource) 3 dp:

public static dependencyproperty queryproperty; public static dependencyproperty maxrowsperpageproperty; public static dependencyproperty opcsessionproperty; 

and respective public getters , setters:

[category("common")] public string query {     { return (string)getvalue(queryproperty); }     set { setvalue(queryproperty, value); } }  [category("common")] public uint32 maxrowsperpage {     { return (uint32)getvalue(maxrowsperpageproperty); }     set { setvalue(maxrowsperpageproperty, value); } }  [category("common")] public uasession opcsession {     { return (uasession)getvalue(opcsessionproperty); }     set { setvalue(opcsessionproperty, value); } } 

the problem tha propertychanged callback "opcsession" variable (the 1 custom type) isn't fired.

static constructor

opcsessionproperty = dependencyproperty.register("opcsession", typeof(uasession), typeof(summarysource), new frameworkpropertymetadata(null, frameworkpropertymetadataoptions.affectsrender, new propertychangedcallback(onsessionchanged))); 

the callback

private static void onsessionchanged(dependencyobject sender, dependencypropertychangedeventargs e) {     messagebox.show("he3e1");     summarysource thiscontrol = (summarysource)sender;     if (thiscontrol.datacontext != null)     {        ((dataretriever)thiscontrol.datacontext).setopcsession((uasession)e.newvalue);     }  } 

the messagebox never showed. if put messagebox.show on other callbacks can see message when load form use control or change value in xaml.

the .xaml

<window.datacontext>         <cs:uasession x:name="opcsession" endpointurl="opc.tcp://192.168.200.11:62543/runtime"/> </window.datacontext>  <control:summarysource x:key="qq" maxrowsperpage="25" opcsession="{binding path=datacontext, elementname=window, presentationtracesources.tracelevel=high, mode=twoway}" /> 

no binding errors in output


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -