When I'm writing my Button, which is inherited from the button, I set the ControlTemplate using an image, the source is x:bind
to a string property in code-behind, like the screenshot below:
<Grid x:Name="rectangle1">
<Image Source="{x:Bind aCheckImage}" //Error Here
Stretch="UniformToFill"
HorizontalAlignment="Center"
VerticalAlignment="Center">
</Image>
</Grid>
Why it throws an error that is "Object reference not set to an instance of an object" in compile. How to fix it?