Inheritance: DependencyObject, IInputScope
Example #1
0
 private void anInputScopeComboBoxes_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
 {
     InputScope scope = new InputScope();
     InputScopeName scopeName = new InputScopeName { NameValue = (InputScopeNameValue)(inputScopeValues[e.AddedItems.First().ToString()]) };
     scope.Names.Add(scopeName);
     aBigTextBox.InputScope = scope;
     aBigTextBox.Focus(FocusState.Keyboard);
 }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            InputScope scope = new InputScope();
            InputScopeName name = new InputScopeName();

            name.NameValue = InputScopeNameValue.Number;
            scope.Names.Add(name);

            textBox1.InputScope = scope;
        }
        private void SetTextBoxToNumerics(TextBox textBox)
        {
            var scope = new InputScope();
            var name = new InputScopeName();

            name.NameValue = InputScopeNameValue.Number;
            scope.Names.Add(name);

            textBox.InputScope = scope;
        }
Example #4
0
        public MainPage()
        {
            this.InitializeComponent();
            this.NavigationCacheMode = NavigationCacheMode.Required;

            InputScope scope = new InputScope();
            InputScopeName name = new InputScopeName();
            name.NameValue = InputScopeNameValue.Number;
            scope.Names.Add(name);
            txtDigita.InputScope = scope;
        }
 public NumberInputBox()
     : base()
 {
     TextChanged += TextChangedEvent;
     InputScope = new InputScope()
     {
         Names = {new InputScopeName {NameValue = InputScopeNameValue.Number}}
     };
     Type = InputType.Float;
     MaxValue = MinValue = 0;
     ValueOk = false;
 }
Example #6
0
        // Constructors
        public NumberBox()
        {
            KeyDown += new KeyEventHandler(OnKeyDown);
            TextChanged += new TextChangedEventHandler(OnTextChanged);

            InputScopeName name = new InputScopeName();
            name.NameValue = InputScopeNameValue.Number;
            InputScope scope = new InputScope();
            scope.Names.Add(name);

            InputScope = scope;

            Refresh();
        }
Example #7
0
        public NumericTextBox()
        {
            KeyDown += KeyDownHandler;

            var scope = new InputScope();
            var name = new InputScopeName
            {
                NameValue = InputScopeNameValue.Number
            };

            scope.Names.Add(name);

            InputScope = scope;

            LostFocus += LostFocusHandler;
        }
Example #8
0
 private void addInputType(TextBox field, SupportedWidgets widgetType)
 {
     InputScope scope = new InputScope();
     InputScopeName name = new InputScopeName();
     //textfield or password
     if (widgetType.Equals(SupportedWidgets.TEXTFIELD))
     {
         name.NameValue = InputScopeNameValue.Default;
     }
     else if (widgetType.Equals(SupportedWidgets.NUMBERFIELD) || widgetType.Equals(SupportedWidgets.NUMBERDOUBLEFIELD))
     {
         name.NameValue = InputScopeNameValue.Number;
     }
     scope.Names.Add(name);
     field.InputScope = scope;
 }
        private void TextBox_OnLoaded(object sender, RoutedEventArgs e)
        {
            // "Tag" property can be obtained from there
            var scope = new InputScope();
            var propName = Tag as String;

            if (PropertyInfo == null)
                return;

            // Set input scope
            if (PropertyInfo.PropertyType == typeof(String))
                scope.Names.Add(new InputScopeName { NameValue = InputScopeNameValue.AlphanumericFullWidth });
            else
                scope.Names.Add(new InputScopeName { NameValue = InputScopeNameValue.Number });
            InputScope = scope;

            // Set header
            var display = PropertyInfo.GetCustomAttribute<DisplayAttribute>();
            Header = display != null ? display.Name : propName;
        }
        public void Attach(DependencyObject associatedObject)
        {
            AssociatedObjectAsTextBox = associatedObject as TextBox;

            if (AssociatedObjectAsTextBox == null)
            {
                throw new ArgumentException("NumericTextBoxBehavior can only be used with a TextBox.");
            }

            AssociatedObjectAsTextBox.KeyDown += AssociatedObjectAsTextBox_KeyDown;
            AssociatedObjectAsTextBox.TextChanged += AssociatedObjectAsTextBox_TextChanged;

            if (AssociatedObjectAsTextBox.InputScope == null)
            {
                var inputScope = new InputScope();
                inputScope.Names.Add(new InputScopeName(InputScopeNameValue.Number));
                AssociatedObjectAsTextBox.InputScope = inputScope;
            }

            AssociatedObjectAsTextBox.Loaded += (s, e) => { AssociatedObjectAsTextBox_TextChanged(s, null); };


        }
Example #11
0
        /// <summary>
        /// Visualizza una finestra di dialogo con TextBox
        /// </summary>
        public static async Task<DialogTextBoxResult> DialogTextBox(string content, string title, string box="", string ok="ok", string cancel="annulla", string sub=null, string header=null, InputScopeNameValue scopename=InputScopeNameValue.Default)
        {
            DialogTextBoxResult risposta = new DialogTextBoxResult();
            risposta.result=false;
            risposta.output=null;



            StackPanel stack = new StackPanel();

            if(content != null)
            {
                TextBlock contenuto = new TextBlock();
                contenuto.Text = content;
                stack.Children.Add(contenuto);
            }

            InputScope scope = new InputScope();
            scope.Names.Add(new InputScopeName(scopename));

            TextBox tb = new TextBox();
            tb.Text=box;
            tb.InputScope = scope;
            tb.Header = header;
            tb.Margin = new Thickness(0,5,0,5);
            stack.Children.Add(tb);

            if(sub!=null)
            {
                TextBlock subba = new TextBlock();
                subba.Text=sub;
                subba.TextWrapping = TextWrapping.Wrap;
                stack.Children.Add(subba);
            }


            ContentDialog cd = new ContentDialog();
            cd.Title = title;
            cd.Content = stack;


            cd.PrimaryButtonText = ok;
            cd.PrimaryButtonClick+= (s, ev) =>
            {
                risposta.result=true;
                risposta.output=tb.Text;
            };

            cd.SecondaryButtonText=cancel;
            cd.SecondaryButtonClick+= (s, ev) =>
            {
                risposta.result=false;
                risposta.output=null;
            };

            cd.Opened+=(s, ev) =>
            {
                tb.Focus(FocusState.Keyboard);
                tb.SelectAll();
            };

            await cd.ShowAsync();

            return risposta;
        }
Example #12
0
 internal void setInputScope(Windows.UI.Xaml.Input.InputScope value)
 {
     txtBox.InputScope = value;
 }
 private void setConstraint(TextBox tb, InputScopeNameValue v) {
     InputScope ins = new InputScope();
     InputScopeName insane = new InputScopeName();
     insane.NameValue = v;
     ins.Names.Add(insane);
     tb.InputScope = ins;
 }
Example #14
0
		void UpdateInputScope()
		{
			if (IsPassword)
			{
				_cachedInputScope = InputScope;
				_cachedSpellCheckSetting = IsSpellCheckEnabled;
				_cachedPredictionsSetting = IsTextPredictionEnabled;
				InputScope = PasswordInputScope; // Change to default input scope so we don't have suggestions, etc.
				IsTextPredictionEnabled = false; // Force the other text modification options off
				IsSpellCheckEnabled = false;
			}
			else
			{
				InputScope = _cachedInputScope;
				IsSpellCheckEnabled = _cachedSpellCheckSetting;
				IsTextPredictionEnabled = _cachedPredictionsSetting;
			}
		}