public override void OnApplyTemplate() #endif { base.OnApplyTemplate(); if (InputBox != null) { #if WINDOWS_STORE || WINDOWS_PHONE_APP var binding = new Windows.UI.Xaml.Data.Binding(); #elif WINDOWS_PHONE var binding = new System.Windows.Data.Binding(); #endif binding.Source = InputBox; binding.Path = new PropertyPath("Text"); SetBinding(ValueProperty, binding); TextBinding.SetUpdateSourceOnChange(InputBox, true); InputBox.TextChanged -= InputBoxTextChanged; InputBox.SelectionChanged -= InputBoxSelectionChanged; // manually adding // GetBindingExpression doesn't seem to respect TemplateBinding // so TextBoxBinding's code doesn't fire InputBox.TextChanged += InputBoxTextChanged; InputBox.SelectionChanged += InputBoxSelectionChanged; } }
public override async void OnApplyTemplate() #endif { base.OnApplyTemplate(); InputBox = GetTemplateChild(InputBoxName) as TextBox; if (InputBox != null) { // manually adding // GetBindingExpression doesn't seem to respect TemplateBinding // so TextBoxBinding's code doesn't fire #if WINDOWS_STORE || WINDOWS_PHONE_APP var binding = new Windows.UI.Xaml.Data.Binding(); #elif WINDOWS_PHONE var binding = new System.Windows.Data.Binding(); #endif binding.Source = InputBox; binding.Path = new PropertyPath("Text"); SetBinding(ValueProperty, binding); TextBinding.SetUpdateSourceOnChange(InputBox, true); HookUpEventForIsSubmitOnEnterKey(); if (!ApplicationSpace.IsDesignMode) { await DelayInputSelect(); } } }