I've got an odd situation: Following sample code replaces the Content of the window, uses the setter's background color and provides a stack panel with two labels. One for the background and one for the title.
The thing is, that they during design time
<Label Content="{TemplateBinding Background}" /> does perfectly show the background value however
<Label Content="{TemplateBinding Title}" /> does that only when running the app.
What is the difference here?
I've played around with the TargetType (by setting it to MainWindow, no effect)
This is the full sample:
<Window x:Class="TBinding.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="350" Width="525">
<Window.Style>
<Style TargetType="Window">
<Setter Property="Background" Value="LawnGreen" />
<Setter Property="Title" Value="The title of this window" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Window">
<StackPanel Margin="50" Background="{TemplateBinding Background}">
<Label Content="{TemplateBinding Background}" />
<Label Content="{TemplateBinding Title}" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Style>
</Window>
Found on connect: https://connect.microsoft.com/VisualStudio/feedback/details/770067/wpf-designer-not-sho
Designer creates a proxy for Window classes and not the Window itself. The substitute does not fully reflect all properties therefore has limited functionality.
This issues occurs in VS2012 as well in VS2013.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With