要绑定到什么内容以操纵HorizontalAlignment?传递一个简单的字符串似乎不起作用,但是我找不到一个示例。
private string _CategoryHorizontalAlignment;
public string CategoryHorizontalAlignment
{
get { return _CategoryHorizontalAlignment; }
set
{
_CategoryHorizontalAlignment = value;
NotifyPropertyChanged("CategoryHorizontalAlignment");
}
}
...
<ControlTemplate TargetType="Label">
<Border x:Name="_brdMain"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
CornerRadius="7,7,7,7" Padding="{Binding CategoryPadding, UpdateSourceTrigger=PropertyChanged}">
<ContentPresenter HorizontalAlignment="{Binding CategoryHorizontalAlignment, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" />
</Border>
</ControlTemplate>