locked
How to handle textchanged event in Windows Store app. RRS feed

  • Question

  • Hi All,

    I want to handle textchanged event in windows store app but I didn't find GetBindingExpression and UpdateSource methods as those are in windows phone 8 app.

    can any one help me .


    srujana

    Tuesday, November 26, 2013 12:02 PM

Answers

All replies

  • Hello chandana30, 

    show this link: http://www.wiredprairie.us/blog/index.php/archives/1701

    • Marked as answer by chandana30 Wednesday, November 27, 2013 3:49 AM
    Tuesday, November 26, 2013 12:15 PM
  • i created an own textbox control for this:

    public class BindableTextBox : TextBox
        {
            public string BindableText
            {
                get { return (string)GetValue(BindableTextProperty); }
                set { SetValue(BindableTextProperty, value); }
            }
    
            // Using a DependencyProperty as the backing store for BindableText.  This enables animation, styling, binding, etc...         
            public static readonly DependencyProperty BindableTextProperty = DependencyProperty.Register("BindableText", typeof(string), typeof(BindableTextBox), new PropertyMetadata("", OnBindableTextChanged));
    
            private static void OnBindableTextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs eventArgs)
            { ((BindableTextBox)sender).OnBindableTextChanged((string)eventArgs.OldValue, (string)eventArgs.NewValue); }
    
            public BindableTextBox() { TextChanged += BindableTextBox_TextChanged; }
    
            private void OnBindableTextChanged(string oldValue, string newValue)
            {
                Text = newValue ?? string.Empty;
            }           
            
            private void BindableTextBox_TextChanged(object sender, TextChangedEventArgs e) { BindableText = Text; }
        }


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 26, 2013 12:15 PM
  • Thanks Nipun

    srujana

    Wednesday, November 27, 2013 3:49 AM