View previous topic :: View next topic |
Author |
Message |
pavd
Joined: 08 Sep 2010 Posts: 9
|
Posted: Wed Sep 08, 2010 7:11 pm Post subject: Preview of wpf usercontrol shows nothing |
|
|
Two questions:
1) I have some dll vs2010 projects with derived usercontrol wpf xaml items.
After scanning, rebuilding the project and try to preview the result I see nothing.
I use .NET 4.0 Any idea what can be wrong?
2) In the exe project I have a wpf window xaml. That window is previewed in the language english while in the control panel dutch is specified. How can I show the window in dutch in the VS designer?
Best regards,
Arjan van Dam |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Sep 08, 2010 10:49 pm Post subject: |
|
|
It looks like there is an issue with previewing WPF controls in the current version of Globalizer.NET. We will fix this and get a release out as soon as possible.
In Globalizer.NET you can change the preview language via the "world" icon drop down in the top left of the Preview Window. If you select Auto then the preview language will automatically change to the selected culture in the translation window.
The Visual Studio WPF designer does not itself support changing cultures - however the Infralution ResxExtension (which is what Globalizer.NET changes XAML to use) adds and icon to your windows Icon Tray which allows you to change the culture at design time (provided you have built the project). See the following Code Project article for more detail:
http://www.codeproject.com/KB/WPF/WPF_Resx_Localization.aspx _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Sep 15, 2010 12:19 am Post subject: |
|
|
Version 2.3.4 of Globalizer.NET has just been released and fixes the issue with previewing WPF controls. _________________ Infralution Support |
|
Back to top |
|
|
pavd
Joined: 08 Sep 2010 Posts: 9
|
Posted: Wed Sep 15, 2010 7:00 pm Post subject: |
|
|
Thanks for fast release.
Question 2 was answered clear, it works!
Question 1 about the preview has new outcomings:
Preview still doesn't work but now I get an error message E204: because A) 1) it needs a parameter less constructor and 2) it doesn't call methods that required external initialisation.
Because my windows and controls have parameterless constructors it must be reason 2. Most of mine controls are part of mine CAL ( Composite Application Library) application (a.k.a Prism). But the same error is also with a simple window with few code behind. I will upload this.
B) I get an error when I choose Scan and then press WPF options... see text below:
---------------------------
Unexpected Error
---------------------------
E401: Globalizer.NET has experienced an unexpected error. Please report details of this error to Infralution (use Ctrl-C to copy the error to the clipboard).
Click Abort to exit Globalizer.NET Click Retry to attempt to continue. Click Ignore to ignore future errors of this type.
Exception: System.NullReferenceException
Description: Object reference not set to an instance of an object.
Stack Trace:
at Infralution.Controls.VirtualTree.Column.set_Icon(Icon value)
at Infralution.Globalizer.WpfScanOptionsDialog.InitializeComponent()
at Infralution.Globalizer.WpfScanOptionsDialog..ctor(Workspace workspace)
at Infralution.Globalizer.ScanDialog._wpfOptionsButton_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) |
|
Back to top |
|
|
pavd
Joined: 08 Sep 2010 Posts: 9
|
Posted: Wed Sep 15, 2010 7:07 pm Post subject: |
|
|
I didn't find any upload possibility so here is the windows1 code:
This code searches for translated satellite assemblies and displays the names in a listbox. The user can select a language and runtime language change is done with the infralution dll. This works really great. But again, why canb this simple listbox not be previewed in Globalizer.
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
CultureInfo[] info = CultureInfo.GetCultures(CultureTypes.AllCultures);
langList.Items.Add(CultureInfo.InvariantCulture);
foreach (CultureInfo ci in info)
{
var assemblyName = GetSatelliteAssemblyName(ci);
if (File.Exists(assemblyName))
{
try
{
if (Assembly.GetExecutingAssembly().GetSatelliteAssembly(ci) != null)
{
langList.Items.Add(ci.DisplayName);
}
}
catch (Exception)
{ }
}
}
langList.SelectedIndex = 0;
}
String GetSatelliteAssemblyName(CultureInfo ci)
{
var assembly = Assembly.GetExecutingAssembly();
var name = assembly.GetName().Name;
string exePath = System.IO.Path.GetDirectoryName(assembly.Location);
return exePath + "\\" + ci.Name + "\\" + name + ".resources.dll";
}
private void OK_Click(object sender, RoutedEventArgs e)
{
CultureInfo[] info = CultureInfo.GetCultures(CultureTypes.AllCultures);
foreach (CultureInfo ci in info)
{
if (ci.DisplayName == langList.Items[langList.SelectedIndex].ToString())
{
CultureManager.UICulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
}
}
}
}
} |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Sep 15, 2010 11:34 pm Post subject: |
|
|
Oops - I'm not sure how that error (when selecting WPF options) slipped through our testing. Since we didn't actually make changes to that are in the last release I think it is the result of some changes to lower level components. We will get a fix out ASAP. I will also take a look at your preview issue. _________________ Infralution Support
Last edited by Infralution on Thu Sep 16, 2010 2:09 am; edited 1 time in total |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Sep 16, 2010 12:31 am Post subject: |
|
|
I've just modified the sample WPF project to load a listbox using the code your provide above in the WindowLoaded event. I was able to preview it in Globalizer.NET without any problem - so there must be something else going on in your code.
If you are using the Developer Edition of Globalizer.NET it also prints out the exception and stack trace of where the error occurred in your code - this should help pin point what the issue may be. Generally you need to avoid having your constructor (or OnLoad/Load methods) calling methods/variables that require external initialization. One simple technique that can work is to have a static InDesignMode property that is set by default to true. When your application starts (for WPF in your App.Startup event handler) then you set this property to false. Then your controls and forms can check this property and only execute code in the constructor/load methods if you are not in design mode.
If you have got a sample project that fails to preview (and you can't work out why) then you can email a zipped copy to support@infralution.com and we will take a look. _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Sep 16, 2010 2:08 am Post subject: |
|
|
Thanks for reporting that bug in the Scan Dialog. We've just released the fix in Version 2.3.5. _________________ Infralution Support |
|
Back to top |
|
|
pavd
Joined: 08 Sep 2010 Posts: 9
|
Posted: Thu Sep 16, 2010 6:43 am Post subject: |
|
|
Thanks a lot again for fast release. The WPF Options... bug is solved.
I succeeded to preview the window1 example (even with 2.3.4) : I restarted globalizer and preview succeeded!
Mine other wpf controls still cannot be previewed.
There is no error reported, it just shows nothing.
I will try to make a little sample project with the problem and send it to you. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Sep 22, 2010 4:34 am Post subject: |
|
|
Version 2.3.6 has now been released and includes a fix related to previewing WPF Controls that have Auto Height or Auto Width set. Previously in this case you would not get an error - however the size of the control would be zero so there would be no visible preview. _________________ Infralution Support |
|
Back to top |
|
|
|