Telerik.Windows.FrameworkPropertyMetadata

1 posts, 0 answers
  1. baba ti
    baba ti avatar
    3 posts
    Member since:
    Mar 2014

    Posted 25 Mar 2015 Link to this post

    How to set at runtime in my dependency property

    DefaultUpdateSourceTrigger = UpdateSourceTrigger.LostFocus


    Here is my example:

    public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(TagEditLookupBox),
                new Telerik.Windows.FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(OnTextSearchChanged)));
     
            private static void OnTextSearchChanged(DependencyObject o, DependencyPropertyChangedEventArgs args)
            {
                var view = (o as NasaEditBox);
                if (view == null)
                    return;
                //...
            }
     
            [DefaultValue("")]
            public string Text
            {
                get
                {               
                    var value = GetValue(TextProperty);
                    if (value == null)
                        return string.Empty;
                    else
                        return value.ToString();
                }
                set
                {            
                    SetValue(TextProperty, value);
                }
            }


    I set  property
    BindsTwoWayByDefault = true,

    but how to do that with DeafultUpdateSourceTriger


    I do not want to set in xaml, runtime in my dependency property only.
Back to Top