別の SO ユーザーから提供されたヘルパー クラスを使用して、ラベルに文字列書式を適用しようとしています。ただし、彼のソリューションを適用すると、次のエラーが発生します。
The object 'Label' already has a child and cannot add ''. 'Label' can accept only one child.
ラベルは次のとおりです。
<Label Grid.Column="1"
Grid.Row="1">
<ui:Helper.Text>
<PriorityBinding>
<Binding Path="Worker.Employer.Name" StringFormat="Employer: {0}" />
<Binding Source="Unemployed" />
</PriorityBinding>
</ui:Helper.Text>
<Binding RelativeSource="{RelativeSource Self}" Path="(ui:Helper.Text)" />
</Label>
エラーは「Binding RelativeSource...」行を指しています。これを修正するにはどうすればよいですか? Label
s の代わりにsを使用したいTextBlock
のですが、それだけの価値がないところまで来ています。