显式XAML样式不适用于某些属性

时间:2014-12-05 11:17:28

标签: c# wpf xaml

在LogOnView.xaml中:

<controls:FloatingTouchScreenKeyboard
    Style="{StaticResource TouchScreenKeyboardStyle}"
    x:Name="TouchKeyboard"
    Placement="Bottom"               <--- Only gets applied if I put this here
    VerticalOffset="-300"            <--- Only gets applied if I put this here
    HorizontalAlignment="Center"/>

在Styles.xaml中:

<Style x:Key="TouchScreenKeyboardStyle"  TargetType="controls:FloatingTouchScreenKeyboard">
    <Setter Property="IsOpen" Value="True"/>
    <Setter Property="Width" Value="300"/>
    <Setter Property="Height" Value="355"/>
    <Setter Property="Placement" Value="Bottom"/>     <--- No effect
    <Setter Property="VerticalOffset" Value="-300"/>  <--- No effect
    <Setter Property="AreAnimationsEnabled" Value="True"/>
    <Setter Property="IsAllowedToFade" Value="False"/>
    <Setter Property="MaximumKeyboardOpacity" Value="1.0"/>
    <Setter Property="MinimumKeyboardOpacity" Value="1.0"/>
    <Setter Property="Opacity" Value="1.0"/>
</Style>

为什么在我定义TouchScreenKeyboardStyle样式时不会应用Placement和VerticalOffset属性?所有其他属性都可以正常工作。

0 个答案:

没有答案