c# - How to apply StringFormat to a wpf textbox conditionally -


I have a text box that pops up with DB. DB value should be due to string format which is due to string formatting. This value can change the user. If the user edits the value in a different format then string formatter should not be reformed.

How can I get it?

  & lt; TextBox x: name = "txtStartDate" height = "24" width = "80" padding = "0" maximum length = "10" text = "{binding path = selected date, string format = 'deed, ddmmm', relative sorce = {Relative Abras ancestor type = {x: type date picture}}} "/ & gt;   

There is a custom control in the textbox real project.

e.g. DB sends a value, as it changes in May 30 and is displayed in the text box, it is expected that if the user changes it back to May 30 then it should not be changed and May 30 be displayed needed. What really is happening is that the value is formatted back in 30 months, so once the user wants to stop formatting after touching the value. When writing WPF, it will be your thoughts / UserControl s and / or With the window s always is the best exact data they need, I will add some additional properties to simplify this problem. I'll need a datetime property, a string property and a bool property dateTime property is obvious that DatePicker is the source of the date from , string returns an output value and the bool property specifies that the starring format is to be applied in the date value or not. You can try something like this:

  bound with the public date time date / datePicker {received {date of return; } Set {date = value; NotifyPropertyChanged ("Date"); Effectarm = your lagicar (); }} Public balls are notificated {get; Set; } The public string date value {received} is return isformatted? date. Toastring ("Deed, DDMM"): Date. Toasting (); }}   

is a code that is displayed in the UI and will either output the default datetime value, or the value will be formatted, imformed Depending on the value of the property

I think that you are assuming that isFormatted property is true or Set to false . The user or value depends on some changes, so when the user changes the value, you can set it to true and then it will not be just a date format. You may need to add or replace any other property with this example to implement your requirements, but you should still get this idea and I believe that you will be able to complete it here.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -