wpf - How to change Dateformat -


how change date format of viewmodel's datetime type property using clture. using below code change culture.

        cultureinfo newculture = null;         newculture = (cultureinfo)thread.currentthread.currentculture.clone();         newculture.datetimeformat.shortdatepattern = "dd/mm/yyyy";         newculture.datetimeformat.dateseparator = "/";           if (newculture != null)         {             thread.currentthread.currentculture = newculture;             thread.currentthread.currentuiculture = newculture;         } 

view's datetimepicker format has been changed in viewmodel's property format not reflect. appreciated.

below property.

    private datetime _fromdate = datetime.now;     public datetime fromdate     {         { return _fromdate; }         set         {             _fromdate = value;              onpropertychanged("fromdate");         }     } 

if check value of fromdate in backgroundworker use same format of system.

//here format describe "dd/mm/yyyy"

    var worker = new backgroundworker();         worker.dowork += (o, ea) =>         {         //and here system format          };         worker.runworkercompleted += (o, ea) =>         {          }; 

possible solution: have change culture inside backgroundworker.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -