The current instance of WebContext is not available


i'm trying create sl web site , allow authenticated user click of buttons.  somehow i'm getting above messgae @ design time compilation didn't failed.  when ran it, i'm not getting expect.  i've searched same subject can't idea other posting fix it.  can help?  see partial code below:

 xmlns:auth="clr-namespace:yesido.viewmodels"                 d:designwidth="640" d:designheight="480"             title="products page">      <navigation:page.resources>          <auth:productsviewmodel x:key="adm"/>      </navigation:page.resources>


 

using system;  using system.windows;  using system.servicemodel.domainservices.client.applicationservices;    namespace yesido.viewmodels  {      public class productsviewmodel : viewmodelbase      {          private visibility _adminbuttonvisbility;            public visibility adminbuttonvisbility          {              { return _adminbuttonvisbility; }              set               {                  if (_adminbuttonvisbility != value)                  {                      _adminbuttonvisbility = value;                      notifypropertychanged("adminbuttonvisbility");                  }                   }          }            public productsviewmodel()          {              webcontext.current.authentication.loggedin += new eventhandler<authenticationeventargs>(authentication_loggedin);              webcontext.current.authentication.loggedout += new eventhandler<authenticationeventargs>(authentication_loggedout);          }            void authentication_loggedout(object sender, authenticationeventargs e)          {              adminbuttonvisbility = visibility.collapsed;          }            void authentication_loggedin(object sender, authenticationeventargs e)          {              adminbuttonvisbility = visibility.visible;          }      }  }


 

never mind, i've got answer from ian griffins' tutorial video.  resolved adding "if (!designerpropeeties.isindesigntool)" condition.



Silverlight  >  Silverlight Controls and Silverlight Toolkit



Comments

Popular posts from this blog

Motherboard replacement

Remote Desktop App - Error 0x207 or 0x607

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state