Replies: 2 comments
|
Can you open a bug with repro? It's not a common usecase, but seems like something is broken. |
|
Two things in that snippet would make the button render nothing even if the template itself is fine. 1. The button has no <Button Content="Hello" ContentTemplate="{Binding StringTemplate}" />2. The binding path. A quick way to rule out the view-model side is to put the template in resources and reference it directly: <Window.Resources>
<DataTemplate x:Key="StringTemplate" DataType="x:String">
<TextBlock FontSize="18" Text="{Binding}" />
</DataTemplate>
</Window.Resources>
<Button Content="Hello" ContentTemplate="{StaticResource StringTemplate}" />If that renders and the bound version still doesn't (with |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I am trying to override the ContentTemplate for the Button, but nothing happens.
Template definition:
Using the template:
<Button ContentTemplate="{Binding t:StringTemplate}" xmlns:t="clr-namespace:Namespace.StringTemplate" />The StringTemplate property is defined in the ViewModel.
This is a simple example. In reality, the template is more complex - it’s not just a string.
All reactions