Oh, duh, it's really easy. I just want:
WindowTitle="{x:Static local:LocalizedStrings.PageOneTitle}"
That is, set it directly rather than applying via a binding. I was making it way too complicated...
Question
I'm creating a WPF wizard control following the MSDN Structured Navigation example. My working XAML looks like this, where my WizardBase is a subclass of System.Windows.Navigation.PageFunction
, and MyPageOne is a subclass of WizardBase (namespaces and class names changed for privacy):
<local:WizardBase
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:My.Namespace"
x:Class="My.Namespace.MyPageOne"
KeepAlive="True"
WindowTitle="Page One">
This works great: when I navigate to this page in the wizard, the dialog title changes to "Page One". But now I want to internationalize that string. So I changed it to:
WindowTitle="{Binding Source={x:Static local:LocalizedStrings.PageOneTitle}}"
which fails at runtime with:
A 'Binding' cannot be set on the 'WindowTitle' property of type 'MyPageOne'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.
What's special about WindowTitle that it can be set but not bound? I'm assuming that I've just made some kind of novice error.
Solution
Oh, duh, it's really easy. I just want:
WindowTitle="{x:Static local:LocalizedStrings.PageOneTitle}"
That is, set it directly rather than applying via a binding. I was making it way too complicated...