public static TextFieldInputVisualStateService GetTextFieldInputVisualStateService( [NotNull] this FrameworkElement @this) { @this.IsNotNull(nameof(@this)); return(HintAssist.GetTextFieldInputVisualStateService(@this)); }
public static IStringValidator GetValidator( [NotNull] this FrameworkElement @this) { @this.IsNotNull(nameof(@this)); return(HintAssist.GetValidator(@this)); }
public static bool GetIsRequiredField( [NotNull] this FrameworkElement @this) { @this.IsNotNull(nameof(@this)); return(HintAssist.GetIsRequiredField(@this)); }
protected override void OnElementDetaching( IFrameworkInputElement element) { var frameworkElement = element.As <FrameworkElement>(); HintAssist.SetInputDataAdapter(frameworkElement, null); frameworkElement.Loaded -= OnLoaded; element.GotKeyboardFocus -= OnGotKeyboardFocus; element.LostKeyboardFocus -= OnLostKeyboardFocus; element.PreviewTextInput -= OnPreviewTextInput; }
public static TextFieldInputDataAdapter GetInputDataAdapter( [NotNull] this FrameworkElement @this) { @this.IsNotNull(nameof(@this)); var inputDataAdapter = HintAssist.GetInputDataAdapter(@this); if (inputDataAdapter == null) { throw new InvalidOperationException( $"The \'HintAssist.InputDataAdapter\' attached property has not been set."); } return(inputDataAdapter); }
protected override void OnElementAttaching( IFrameworkInputElement element) { var frameworkElement = element.AsOrDefault <FrameworkElement>(); if (frameworkElement == null) { throw new NotSupportedException( $"Cannot host a {nameof(TextFieldInputVisualStateService).SQuote()} on the type " + $"{element.GetType().Name.SQuote()} because it must be assignable to the type " + $"{nameof(FrameworkElement).SQuote()}."); } HintAssist.SetInputDataAdapter(frameworkElement, new TextFieldInputDataAdapter(element)); frameworkElement.Loaded += OnLoaded; element.GotKeyboardFocus += OnGotKeyboardFocus; element.LostKeyboardFocus += OnLostKeyboardFocus; element.PreviewTextInput += OnPreviewTextInput; }