Mask for a datepicker field in an application

Asked

Viewed 390 times

0

I have an application in wpf, so there are windows that have fields for date types, I put these fields with datepicker in which there is a calendar for choosing the date.

So far so good, what I could not put is a mask to look like this "00/00/0000" in this field, accepting only numbers.

Does anyone have any idea what I can do?

1 answer

0

<TextBlock Text="{Binding Start, StringFormat=d}" />

or

 <TextBlock Text="{Binding Path=OrderDate, StringFormat='{}{0:dd.MM.yyyy}'}"/>
  • <Datepicker Name="datepickerData" Horizontalalignment="Left" Margin="421,128,0,0" Verticalalignment="Top" Height="31" Width="128" Mouseleftbuttondown="datepickerData_MouseLeftButtonDown"/> I have it Fabio, I put it inside?

  • <Datepicker Horizontalalignment="Left" Displaydate="{x:Static System:Datetime.Now}" Selecteddate="{Binding Path=Data, Stringformat='{}{0:dd.MM.yyyy}'}" Margin="139,58,0,0" Verticalalignment="Top" Width="120"/>

  • Try this above, I’m off my windows pc... but this should suit.

  • Error 1 Unknown build error, 'Key cannot be null. Parameter name: key Line 114 Position 88. ' gives asim error. Does not accept x: Static System:Datetime.Now

  • Sorry, I made an error, the property you have to apply the mask, is the Displaydate, not selectedDate <Datepicker Horizontalalignment="Left" Displaydate="{Binding PROPRIEDADE_DATA, Stringformat='{}{0:dd.MM.yyyy}'}" Selecteddate="{Binding Path=Data}" Margin="139,58,0,0" Verticalalignment="Top"

  • PROPRIEDADE_DATA what it would be?

  • Your property will be selected. For example, in your data model, you have something of the Date type selected... Then you would put this

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.