c# - Invalid ContentPropertyAttribute on property 'Text' -


I'm having trouble setting up my content property in "text." The error I am given is:

Invalid content property entry type 'MyType', property 'text' was not found.

The code behind this looks like this:

  [ContentProperty ("text")] Public partial class MyType: UserControl {public MyType () {InitializeComponent (); } Public static read-only dependency form TextProperty = DependencyProperty.Register ("text", typef (string), typef (myType)); Public Stabilized String GetText (Dependency Object D) {Return (String) d.GetValue (TextProperty); } Public static zero SetText (dependent object D, string value) {d.SetValue (TextProperty, value); } Public string text {get {return (string) GetValue (TextProperty); } Set {set value (textproperty, value); }}}  

I have actually found it to work if I keep the name of the CLR property in addition to the dependency property - am I using dependency properties incorrectly ?

I thought that type of type (linolextext) should be (methype), but I used my test project Was able to compile. Can you post an XAM file which is causing the error?

Edit: Followup

Your problem is two static methods in your code sample, try deleting them, and it should be compiled and working stable Ways only work with enclosed properties, not dependency properties.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -