views:

42

answers:

0

Hello, I try to define TextEdit DependencyProperty, because I want to get a TextEdit "Text" value, which was inputed by user. Then I want to use this value in another static class, which forms an SQL query depending on that entered "Text". My Dependency Property:

public class FrameworkElement : UIElement
    {
        public static readonly DependencyProperty TextBoxEnteredValueProperty;

        static FrameworkElement()
        {

            FrameworkPropertyMetadata metadata1 = new FrameworkPropertyMetadata(
                new TextEdit(), FrameworkPropertyMetadataOptions.AffectsMeasure);
            TextBoxEnteredValueProperty = DependencyProperty.Register("Text",
            typeof(TextEdit), typeof(FrameworkElement));


        }


        public TextEdit TextBoxValueForText
        {
            set { SetValue(TextBoxEnteredValueProperty, value); }
            get { return (TextEdit)GetValue(TextBoxEnteredValueProperty); }
        }


    }

Then I try to get a value, but everything what I get is "null" :

public static string ExecuteCmd1(Window form)//, string CommandName, string[] Args)
        {
            object ddd = form.GetValue(FrameworkElement.TextBoxEnteredValueProperty); }

What I do wrong, can someone Help me with that? Thanks