ComponentOne Basic Library for UWP
Basic Library Overview / Input for UWP / Input for UWP Task-Based Help / C1NumericBox Task-Based Help / Locking the Control from Editing
In This Topic
    Locking the Control from Editing
    In This Topic

    By default the C1NumericBox control's C1NumericBox.Value property is editable by users at run time. If you want to lock the control from being edited, you can set the C1NumericBox.IsReadOnly property to True.

    At Design Time

    To lock the C1NumericBox control from run-time editing, complete the following steps:

    1. Click the C1NumericBox control once to select it.
    2. Navigate to the Properties tab, and check the C1NumericBox.IsReadOnly check box.

    This will set the C1NumericBox.IsReadOnly property to False.

    In XAML

    To lock the C1NumericBox control from run-time editing in XAML add IsReadOnly="True" to the <Xaml:C1NumericBox> tag so that it appears similar to the following:

    Markup
    Copy Code
    <Xaml:C1NumericBox x:Name="C1NumericBox1" IsReadOnly="True"></Xaml:C1NumericBox>
    

    In Code

    To lock the C1NumericBox control from run-time editing add the following code to your project:

    Visual Basic
    Copy Code
    C1NumericBox1.IsReadOnly = True
    

     

    C#
    Copy Code
    c1NumericBox1.IsReadOnly = true;
    

    Run your project and observe:

    The control is locked from editing; notice that the Up and Down buttons are grayed out and inactive.