DateTime formatting in SSRS ReportViewer always uses en-US? - winforms

I'm having a show-stopping issue with the ReportViewer component that's part of SSRS. I'm working on a WinForms application and have a couple of local reports that show DateTime values from the database in various locations. Regardless of how the formatting is done (no formatting at all, using "d" in the Format property, or using FormatDateTime with any of the DateFormat enumeration values), it always appears to format the DateTime with the en-US culture rather than the system date and number formatting culture.
I've validated that CurrentCulture is as expected. The report language is set to "Default". The Language tag is not even present in the .rdlc file. If I change the report language then it appears to reflect the formatting for that culture regardless of the system culture.
Is there a way either to render the report with the current system culture, or programmatically modify the language of the report based upon the culture?

It turns out that "Default" as a Language setting doesn't do much. In order to pick up the user's current culture, Language has to be specified as the expression "=User.Language" (this also needs to be set on all subreports, as the value doesn't propagate or inherit).
Credit to Chris May in his blog article on the subject.

Related

Is there a way to change the text of the "no data" message in data studio, when there is no database in a specific date range?

Is there a way to change the text of the "no data" message in data studio, when there is no database in a specific date range?
In fact, it would be nice to have this option. But, as it is not available for now, I made a workaround to "hide" this:
Change the default font color to the same of background
Add a "conditional formatting" for an item of your list to the condition "not blank" and set the font color to any of your preference.
This is not possible.
This string is hardcoded in Table standard visual of Data Studio and currently there is no option to change this string.
However, this string follows the user current locale. So, if the user access your report in a language different than english, it will follow the user locale.
This is an example of a table with no data in portuguese:
Notice it displays "Não há dados" instead of "No data".
Actually there is a way to change this view in the table. You can choose how it looks when there is no data from the Missing Data field in the Style tab
PS: It wasn't there when you asked, and it may have just been added. I don't know :)

How to set Silverlight 5 CurrentCulture & CurrentUICulture separately on DatePicker & TimePicker Control?

I have set two different cultures to the thread as:
Thread.CurrentThread.CurrentCulture = "fi-FI"
Thread.CurrentThread.CurrentUICulture = "en-Us"
But the calender text is shown in Finnish culture.
I need to keep the Text(Translations) based on CurrentUICulture and Text Format based on CurrentCulture.
Can you please suggest how can it be done for it?
That is not possible. The Calendar control only reacts to the CurrentCulture value. CurrentUICulture is used by the ResourceManager to load up different strings, images etc. used in the UI, but that is not where the day/month names are stored. They are part of the .NET framework itself. To get the functionality you want you will have to write your own implementation of the DatePicker and/or TimePicker controls. Perhaps you could download the code for the Silverlight Toolkit and use that as a base for your own implementation. What you are looking for is basically a way of overriding the names of months and days manually. Maybe it is even possible to extend the controls and add that functionality on top, but I doubt it.

How to supress WPF tool tips?

Is there a way to supress WPF tool tips, other than by setting their content to null?
I am extending the Calendar control to provide date highlighting, using Charles Petzold's MSDN article as a guide. As per the article, I use a value converter to return a string if a date on in the Calendar was found in a date list. The string (number of appointments for the day, for example) is displayed as a tool tip when the mouse is over the date. If the date wasn't found in the list, the value converter returns null.
Overall, it's pretty cool, but I'd like to provide an option to turn the tool tips off and just show highlighting. I am already using a null value when a date is not found, so that a tooltip is not displayed for that date. The null value also supresses the highlighting for that date. So, I can't simply return a blanket null if tool tips are turned off, because it would turn off the highlighting, as well.
I tried creating the tool tip in a separate tag and giving it a name, so that I could use a data trigger to turn it on and off. No go-- a tool tip is considered a property, and while it will compile as a separate object, it throws a runtime exception.
I also tried returning a coded value, 'NOSHOW' if the date was not found in the date list, so that I could use null to supress tool tips. Unfortunately, that gives every unhighlighted date a tool tip that says NOSHOW.
So, at this point I am scratching my head. Any suggestions as to how I can get this done? Thanks for your help!
ToolTipService.IsEnabled=False
<TextBox ToolTipService.IsEnabled="False" />

WinForms - Localization - UI controls positions different in additional Culture

I did my UI settings.Original language is English. After that I set Localizable property to True. Copied original resx file to frmMain.de-De.resx (for example). Translated all strings. Everything works.
But now I would like to change positions of controls. After that changes are visible only for original/primary Culture (En). When I change Culture to de-De then UI controls are on the "old positions"(?!)
Is this normal behaviour? :O I'm unable to change controls positions on my form after localization?
Can someone explain me this and give some best solution. I really have to change UI design but I don't want to manual copy all translated strings again.
If my description is not clear then I can post source code, just please let me know. I use VS 2008.
Greetz!
If you select the form itself in the designer, and look at the properties there should be a field Language.
Leave this to default when designing the form: this is the default layout for languages without a specific layout. Now, if you want a different layout or even different labels for another language, select the correct culture from the Language property and start designing your form.
By doing so, making changes to the default (in your case english) layout will not be reflected on the specific language's form. This is the way it is supposed to work, the layout of languages is completely separate.

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