Reputation: 1089
I have c#-code behind to set the title for my XAML-window:
this.Title = string.Concat(Business_Layer.Properties.Resources.WORD_VEHICLE_DATA_SHEET,
" - ",
(dataContext as Business_Layer.Windows.MainWindow).SelectedVehicle.LicenseNumber);
I want to achiev this in XAML directly. So I have tried:
<Window.Title>
<MultiBinding StringFormat="{}{0} - {1}">
<Binding Source="{x:Static Stringtable:Resources.WORD_VEHICLE_DATA_SHEET}"/>
<Binding Source="{x:Static SelectedVehicle.LicenseNumber}"/>
</MultiBinding>
</Window.Title>
The 'SelectedVehicle'-Property is in the DataContext. With this approach I always get errors. I have tried Path instead of source without any success..
Thanks in advance!
Edit:
My problem was the following:
<Binding Path="{SelectedVehicle.LicenseNumber}"/>
I had have the {} between the ""... Sorry for my behaviour ;)
Upvotes: 0
Views: 852
Reputation: 128146
The second binding should be
<Binding Path="SelectedVehicle.LicenseNumber"/>
Upvotes: 2