KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to create a new property to existing WPF controls (Groupbox, textbox, checkbox, etc), one that will storage its acess Level, therefore I've found out Attached Properties. I used as example this site http://dotnetbyexample.blogspot.com.br/2010/05/attached-dependency-properties-for.html Everything was fine, but then I got the following error when trying to use it on some control... Error 1 The property 'DependencyPropertiesHoster.AcessLevel' does not exist in XML namespace 'clr-namespace:ImageGUI.App_Code;assembly=ImageGUI'. Line 131 Position 97. ImageGUI\MainWindow.xaml 131 97 ImageGUI This is my C# code snippet... namespace ImageGUI.App_Code { public static class DependencyPropertiesHoster { //[AttachedPropertyBrowsableForChildren] public static readonly DependencyProperty AcessLevelProperty = DependencyProperty.RegisterAttached( "AcessLevel", typeof(EAcessLevel), typeof(DependencyPropertiesHoster), new PropertyMetadata(AcessLevelChanged) ); // Called when Property is retrieved public static EAcessLevel GetAcessLevel(DependencyObject obj) { if (obj != null) return (EAcessLevel)obj.GetValue(AcessLevelProperty); else return EAcessLevel.Client; //return obj.GetValue(AcessLevelProperty) as EAcessLevel; } // Called when Property is set public static void SetAcessLevel(DependencyObject obj, EAcessLevel value) { obj.SetValue(AcessLevelProperty, value); } // Called when property is changed private static void AcessLevelChanged(object sender, DependencyPropertyChangedEventA
Tags (comma-separated)
Save Edits
Cancel