Share via

Does decimal still not bind to textboxes?

Rod Falanga 1,036 Reputation points
2020-03-07T15:34:54.777+00:00

I know that in the past it wasn't possible to bind a decimal data type to a textbox in a UWP app. You had to use float instead. Is that restriction still true?

Developer technologies | Universal Windows Platform (UWP)
0 comments No comments

Answer accepted by question author

Richard Zhang-MSFT 6,936 Reputation points Microsoft Employee Moderator
2020-03-09T01:50:59.397+00:00

Hello,​

Welcome to our Microsoft Q&A platform!

I tried to create a decimal variable and simple binding:

xaml

<Grid>  
     <TextBox Text="{x:Bind value}"/>  
 </Grid>  

xaml.cs

public decimal value = 10;  
   
 public MainPage()  
 {  
     this.InitializeComponent();  
 }  

It can be displayed successfully, so the It can be displayed successfully, so the TextBox should be able to bind decimal data. should be able to bind decimal data.

Thanks

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Rod Falanga 1,036 Reputation points
    2020-03-10T01:11:56.87+00:00

    Really? How very interesting. Thank you, Richard.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.