When I use this:
<Label Grid.Column="2"
Grid.Row="8"
Content="{x:Static res:Strings.ToolPanelEditView_Validation_MandatoryField}" >
</Label>
It runs just fine.
But when I add the Style tag:
<Label Grid.Column="2"
Grid.Row="8"
Content="{x:Static res:Strings.ToolPanelEditView_Validation_MandatoryField}" >
<Style>
<Setter Property="Label.Margin" Value="0" />
</Style>
</Label>
It doesn't compile saying:
The property 'Content' is set more than once
答案 0 :(得分:14)
Because you set the content property twice. Putting more elements inside an element is the same thing as setting the content property without some additional information
Whenever you are looking to set a property besides content from inside the element you need to wrap it in <Element.Property>
<Label Grid.Column="2" Grid.Row="8" Content="{x:Static res:Strings.ToolPanelEditView_Validation_MandatoryField}" >
<Label.Style>
<Style>
<Setter Property="Label.Margin" Value="0" />
</Style>
</Label.Style>
</Label>
is what you want