Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Configure the InteractionMode of NumericTextBoxDouble in c#

Solved!
Go to solution

Hi,

I'm trying to set the InteractionMode of a NumericTextBoxDouble to TextInput and ButtonClicks but I can't find the way to set 2 Mode like in xaml : InteractionMode="ButtonClicks TextInput"

 

How can I do this in c# ?

test1.InteractionMode = NumericTextBoxInteractionModes.TextInput;

 

Thanks

0 Kudos
Message 1 of 5
(3,454 Views)

The format for flags enum values is to separate them with commas: InteractionMode="ButtonClicks, TextInput".

 

Also, if you edit the property in the Visual Studio designer, it should produce XAML with this format:

InteractionModePropertyEditor.png

~ Paul H
0 Kudos
Message 2 of 5
(3,407 Views)
Solution
Accepted by topic author Vikogy

Thanks for the reply. I think you didn't understood my question. But I found an answer 🙂

XAML

<ni:NumericTextBoxInteractionModes x:Key="WithoutButton">ScrollWheel, ArrowKeys</ni:NumericTextBoxInteractionModes>
        

C#

ntbd.InteractionMode = (NumericTextBoxInteractionModes)this.FindResource("WithoutButton");
0 Kudos
Message 3 of 5
(3,398 Views)
Solution
Accepted by topic author Vikogy

Ah, sorry for the misunderstanding: I thought you were trying to set it in XAML. In code, the syntax for combining flags enum values is to use the bitwise-OR operator:

 

ntbd.InteractionMode = NumericTextBoxInteractionModes.ScrollWheel | NumericTextBoxInteractionModes.ArrowKeys;

 

Retrieving a named XAML resource, as in your example, will also work fine.

~ Paul H
Message 4 of 5
(3,391 Views)

Ahhh It is exactly what I was looking for !! Thanks 🙂 

0 Kudos
Message 5 of 5
(3,387 Views)