I am currently doing it like this:
public MainWindow() { InitializeComponent(); Title = Properties.Resources.WindowName; }
How to do the same through WPF binding?
EDITOR: It still does not work in XAML.
Environment: VS2010, .NET 4.0, Windows 7.
Playback Stages:
Create a class library ClassLibrary1 with code:
namespace ClassLibrary1 { static public class Class1 { static public string Something { get { return "something"; } } } }
Create a Windows WPF application in VS2010.NET 4.0.
Edit the main XAML window:
<Window x:Class="ahtranslator.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ClassLibrary1="clr-namespace:ClassLibrary1;assembly=ClassLibrary1" Title="{Binding Source={x:Static ClassLibrary1:Class1}, Path=Something}" Height="350" Width="525" Icon="/ahtranslator;component/Icon1.ico" WindowStyle="SingleBorderWindow" ShowInTaskbar="False" DataContext="{Binding}">
...
Compilation Error Message:
MainWindow.xaml (7,130): error MC3029: member of ClassLibrary1: Class1 is invalid because it does not have a qualification type name.
Also did I find this My.Resources section in WPF XAML? . And everything seems to work, but it is not.
Microsoft does not provide a description for this error message. Just another topic in the help forum http://social.msdn.microsoft.com/Forums/en/wpf/thread/4fe7d58d-785f-434c-bef3-31bd9e400691 , which also does not help.
c # data-binding wpf xaml
alehro
source share