Custom textbox for date input - wpf

I'm working on a WPF project that require to custom the textbox for user can input (NOT pick like datepicker) the date and the format is "YY\"年\"MM\"月\"DD\"日\"". Example: 16年09月21日. I have no idea how i can do that, please help me!
Thank you very much!

I think you are looking for Masked TextBox.
Please see this link : How to create a Masked textbox usnig WPF

Related

blink a wpf datagrid row

I am new to WPF. I have a requirement where I need to blink a data grid row If the value in the Date is column is less than current date. My Grid is like below.
Name Date
Test 12-02-2015.
Please help me with a complete example solution.
Thanks
What you need to do first of all is to read about:
MVVM
Styles
Triggers
ValueConverters
Ofcourse, you have to read msdn's articles about WPF.
Try to write something, and if something goes wrong, discribe your problems on Stack Overflow and we will help you. Have a nice coding!

Auto complete feature for DatePicker in Silverlight

I am building a silverlight 4 application and the user wants to have a autocompelte feature for
date controls. ( Note I am using the DatePicker). For e.g. when the user types 5 and tabs out
the date should be converted to 5'th of sept 2012 becuase 5'th august has gone past. I also have
some other rules that are in place for this date formation. I planned to write some code
for this one in the KeyUp event but I am unable to get the text that the user has entered in the
datepicker. Also TextInputStart and TextInputUpdate are never called in my case.
I am looking for the correct event in which I can get what the user has entered
Thanks
Amol
I had a similar problem once with the DatePicker of the Silverlight Toolkit. The only way I could solve that was to create a new UserControl using a standard TextBox and a DatePicker. I re-styled the DatePicker so that its default text area remained hidden, and replaced it by the standard TextBox.
I wired the DatePicker's SelectedDate-Property to the Text-Property of the TextBox, so that it would get updated once someone picks a date.
In your case you could use the AutoCompleteBox coming with the Toolkit instead of a standard TextBox and then use some clever logic to prefill the list of auto-complete proposals. Thus your control would look like a standard DatePicker, and mostly behave like one, but would provide a mixed functionality of DatePicker, TextBox and AutoCompleteBox.

How to do find and replace for RichTextBox of WPF. I have done it for windows forms RichTextBox

I want to know how to do find and replace for wpf RichTextBox? I could not get the .Text property of RichTextBox in WPF. please help me.
Thanks
Laxman
There is a forum post that shows how this is done here. You'd need to pass the RichTextBox.Document to the manager shown in that sample code.
There are open source projects like
https://github.com/keyoti/RapidFindReplaceWPF
http://www.codeproject.com/Articles/173509/A-Universal-WPF-Find-Replace-Dialog

Blend Slider Control

Is there a free implementation of the text box in Blend's property grid that allows you to change the number by clicking and dragging? Or perhaps another way to ask is what kind of control called so I can google it?
just try this
http://www.codeproject.com/KB/WPF/MicrosoftBlendStyleTextBo.aspx
It's called a numeric UpDown control. (Terrible name, I know).
MS has a sample implementation for WPF, although I think you'll have to provide the draggable part yourself.

Silverlight Date Formats

I'm getting some very strange date formatting issues in my Silverlight application. My local culture is set to UK, yet I am consistently seeing US dates popping up all over the place. I can easily hardcode these to UK format in specific loactions using:
<UserControl ... Language="en-GB"...>
But as I'm sure you'd all agree this is a terrible thing to do.
I have tried setting the Lanaguage to en-GB in the main application and this has partial success. I have also tried Justin Angels suggestion (posted here: How to change date format in Silverlight DatePicker control?), again only partial success.
An example of the issue can be seen here:
http://lh3.ggpht.com/%5FL9TmtwXFtew/Sw5aVZJfG1I/AAAAAAAAGkI/6jYnsB91HjI/image%5Fthumb%5B1%5D.png http://lh3.ggpht.com/%5FL9TmtwXFtew/Sw5aVZJfG1I/AAAAAAAAGkI/6jYnsB91HjI/image%5Fthumb%5B1%5D.png
The datagrid on the parent page shows UK formatting, whilst the information in the ChildWindow shows US formatting ...grrrr
Anyone have a definitive solution for solving this across a whole application?
Thanks,
Mark
You can data bind Language property of the root visual element. Take a look at my question here:
How to switch UI Culture of data binding on the fly in Silverlight
Can you not use the SelectedDateFormat property of the datepicker? If you want to do this once could you not create your own usercontrol that derives from the original with this value preset, then use your derived control throughout your app?
Kindness,
Dan
Shot in the dark, but does changing the browser's Language Preference make a differnence? I.e. in IE Tools-->Internet Options-->Languages.
HTH
Mark
You can set the date format for your entire application in the application start up event as follows.This will override any regional settings on the users machine
Thread.CurrentThread.CurrentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = dd/MM/yyyy";

Resources