상속: DependencyObject, IInputScope
예제 #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);
 }
예제 #2
0
        /// <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;
        }
예제 #3
0
        private void SetTextBoxToNumerics(TextBox textBox)
        {
            var scope = new InputScope();
            var name = new InputScopeName();

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

            textBox.InputScope = scope;
        }
예제 #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;
        }
예제 #5
0
 public NumberInputBox()
     : base()
 {
     TextChanged += TextChangedEvent;
     InputScope = new InputScope()
     {
         Names = {new InputScopeName {NameValue = InputScopeNameValue.Number}}
     };
     Type = InputType.Float;
     MaxValue = MinValue = 0;
     ValueOk = false;
 }
예제 #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();
        }
예제 #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;
        }
예제 #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;
 }
예제 #9
0
        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); };


        }
예제 #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;
        }
예제 #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;
 }
예제 #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;
			}
		}