Created a new DP
i'm trying add dp user control. i"m not getting build errors new property doesn't show in xaml intelisense. have dps created in other projects , don't differnt this.
1 public shared readonly clientviewtypeproperty as dependencyproperty = dependencyproperty.register("viewtype", gettype(viewtypes), gettype(clientwindow), new propertymetadata(new propertychangedcallback(addressof onclientviewtypechanged))) 2 3 private shared sub onclientviewtypechanged(byval d as dependencyobject, byval args as dependencypropertychangedeventargs) 4 dim sender as clientwindow = ctype(d, clientwindow) 5 sender.type = ctype(args.newvalue, viewtypes) 6 end sub 7 8 private _type as viewtypes 9 public property type() as viewtypes 10 get 11 return _type 12 end 13 set(byval value as viewtypes) 14 _type = value 15 end set 16 end property 17 18 19 end class 20 21 public enum viewtypes 22 23 newonly 24 end enum
thanks
i see several things should address:
1. in registration, string parameter should match property declaration (except property suffix). example:
... clientviewtypeproperty as dependencyproperty = dependencyproperty.register("clientviewtype",...
2. public property called type should match dp declaration (except property suffix). example (in c#):
public viewtypes clientviewtype
{
{ return (viewtypes)getvalue(clientviewtypeproperty); }
set { setvalue(clientviewtypeproperty, value); }
}
Silverlight > Programming Silverlight with .NET – General
Comments
Post a Comment