Trev72

Hi,

I'm trying to set the title of my window to a value in resources.resx. I know I can set it in the code behind but I'm sure it must be possible to set it in the Xaml.

Here's my best attempt to date.

<Window x:Class="TitleResources.Window1"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlnsStick out tongueroperties="clr-namespace:TitleResources.Properties"

Title="{xTongue Tiedtatic properties:Resources.MyWindowTitle}"

Height="300" Width="300"

>

<Grid>

</Grid>

</Window>

Can anyone spot what I've done wrong or point me in the right direction

Trev



Re: Windows Presentation Foundation (WPF) Set Window Title to resources value

Ivan Shumilin

Resources class and MyWindowTitle property should be public.

For VS2005 you can use http://dmytro.kryvko.googlepages.com/

For Orcas Beta 1:
Resources.resx - set
Access Modifier to public (or set Custom Tool to PublicResXFileCodeGenerator)

From readme:

1.3.73. Access Modifier ¡®Public¡¯ is not working in the managed resource editor

After you set the Access Modifier drop-down in the resource editor for a .resx file or for the Resources project properties page, you receive one of the following warnings in the task list:

* Cannot find custom tool 'PublicVbMyResourcesResXFileCodeGenerator' on this system.
* Cannot find custom tool 'PublicResXFileCodeGenerator' on this system. In addition, the resources are not publicly available outside of the assembly.

To resolve this issue:

1. Create a file on your computer named ¡°FixPublicRes.reg¡± and then add the following contents to it:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{74d398e9-7cc3-4ff2-9a4d-acd177f40b58}]
"InprocServer32"="C:\\WINDOWS\\system32\\mscoree.dll"
"Class"="Microsoft.VisualStudio.Design.Serialization.PublicVBMyResXFileCodeGenerator"
"Assembly"="Microsoft.VisualStudio.Design, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
"ThreadingModel"="Both" @="Microsoft.VisualStudio.Design.Serialization.PublicVBMyResXFileCodeGenerator"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{69b6a86d-ef43-4d9e-a758-8a18b38a7384}]
"InprocServer32"="C:\\WINDOWS\\system32\\mscoree.dll"
"Class"="Microsoft.VisualStudio.Design.Serialization.PublicResXFileCodeGenerator"
"Assembly"="Microsoft.VisualStudio.Design, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
"ThreadingModel"="Both" @="Microsoft.VisualStudio.Design.Serialization.PublicResXFileCodeGenerator"

2. Click Start, and then click Run. Type <Path where you saved the file>\FixPublicRes.reg and then click OK.
3. You will be asked whether you want to add the information from FixPublicRes.reg into the registry. Click Yes.
4. In Solution Explorer, right-click the .resx file, and then click Run Custom Tool.





Re: Windows Presentation Foundation (WPF) Set Window Title to resources value

Trev72

Thanks Ivan,

Your help is very much appreciated.

Trev