需要将RadioButton中的TextBlock文本居中设置为ToggleButton

时间:2012-08-07 18:19:00

标签: wpf xaml

也尝试使用标签。

按钮中的文字左对齐。

<ItemsControl ItemsSource="{Binding ButtonLinks}">
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <RadioButton Style="{StaticResource {x:Type ToggleButton}}"                                 
                             Margin="5"
                             Background="{x:Null}"
                             Height="40"
                             FontSize="14"
                             GroupName="Views"
                             FontWeight="Normal"
                             cal:Message.Attach="ShowPage">
                    <TextBlock Text="{Binding BtnText}"
                               TextAlignment="Center"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"/>
                </RadioButton>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>

ETA:

我正在使用MahApps.Metro叠加层,当我删除App.xaml中的控件资源时,它是否有效,基本上是否有一种方法可以覆盖属性,例如您引入的资源上的对齐?

我从app.xaml中删除的行:

<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />

1 个答案:

答案 0 :(得分:0)

我必须覆盖一个RadioButton的Horizo​​ntalAlignment,它在mahapps库中被设置为“Left”。

相关问题