Hi I have a really strange effect here:
I have a main window, which content is filled with a complete visual tree containing the form presentation.
First form to show is the Parent form, which allows to call a child form.
When I load the child form, the Parent is basically backup up into a stack, then the new content is set to the window.
When I close the child form, the backuped up parent is set back as the window content and the child window is dropped.
Now for the problem: I load a collection of objects into a listbox. The listbox uses textblocks for displaying the objects' properties (FirstName, LastName, PhoneNumber,MobileNumber, Email), and after each textblock, a comma is contained in the Xaml to separate the entries.
BUT: if a textblock is empty, the corresponding comma must not be shown, like below:
I managed to do this using a converter that anaylses which commas to show.
This work perfectly, but when I show a child form and closes it, the display is corrupted regarding comma visibility:
I made two observations:
Is there any idea what can cause such effects? And how I can get around them?
Regards
Finally, I found that setting Window.Language was the problem.
I do this in the mainwindows constructor:
this.Language = System.Windows.Markup.XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentUICulture.Name);
This is necessary to get correct display for numbers for example.
But now I issue the following block, and all works in all cultures. [During startup, I check the default Ui culture, and if I set it to any other, I set App.CultureChanged accordingly]:
if (!App.CultureChanged )
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
this.Language = System.Windows.Markup.XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentUICulture.Name);