xaml - WPF Problems with Custom Control -


i have custom control in wpf

public class myclass: control, inotifypropertychanged {     private boolean _hasdata;     public boolean hasdata     {        { return _hasdata};        set         {            _hasdata = value;            onpropertychanged("hasdata");           this.visibility = value ? visibility.visible : visibility.collapsed;        }     }      #region inotifypropertychanged members     // code     #endregion } 

now here's thing: should use control template or data template? purpose of custom control: showing data recieved service.

i tried custom template, properties of control aren't bound/connected properties of xaml code. datacontext of control template control (myclass).

<controltemplate targettype="{x:type controls:myclass}">  <grid visibility="{binding visibility, updatesourcetrigger=propertychanged}"}">       <textblock text="contains data"/>  </grid> </controltemplate> 

if check datacontext (which myclass class), visibility visible or collapsed. visibility of control (myclass xaml) won't bind datacontext visibility. also, if set visibility in constructor collapsed, remains being on collapsed. tried triggers , boolean property show binded grid visibility (with converter of course).

what should now? want control properties visibility in myclass control have same value class myclass.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -