Xaml WP7-可附加属性';资源';在类型';电话应用页面';

Xaml WP7-可附加属性';资源';在类型';电话应用页面';,xaml,windows-phone-7,user-controls,Xaml,Windows Phone 7,User Controls,我正在尝试创建底部栏。在此底部栏中有4个按钮。 现在,我已经创建了底部栏,并将其包含在所有页面中。它起作用了。。!!现在我想删除填充和闪烁的按钮。所以我试着这样做 <UserControl x:Class="NewExample.BottomTabBar" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/x

我正在尝试创建底部栏。在此底部栏中有4个按钮。 现在,我已经创建了底部栏,并将其包含在所有页面中。它起作用了。。!!现在我想删除填充和闪烁的按钮。所以我试着这样做

<UserControl x:Class="NewExample.BottomTabBar"  
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
 d:DesignHeight="100" d:DesignWidth="480"             
shell:SystemTray.IsVisible="True">

<phone:PhoneApplicationPage.Resources>
    <Style x:Key="ButtonStyle1" TargetType="Button">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="Padding" Value="10,3,10,5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}">
                            <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</phone:PhoneApplicationPage.Resources>

<Grid x:Name="BottomToolUIContainer" Height="100" Width="480">

    <Button Command="{Binding Button1}" Background="{Binding BackColor1}" Content="Test 1" Height="120" HorizontalAlignment="Left" Name="MyBeno" VerticalAlignment="Top" Width="140" Margin="-10,-10,0,0" />

    <Button Command="{Binding Button2}" Background="{Binding BackColor2}"  Content="Test 2" Height="120" HorizontalAlignment="Left" Margin="109,-10,0,0" Name="Search" VerticalAlignment="Top" Width="140" />

    <Button Command="{Binding Button3}" Background="{Binding BackColor3}"   Content="Test 3" Height="120" HorizontalAlignment="Left" Margin="228,-10,0,0" Name="MyBasket" VerticalAlignment="Top" Width="140" />

    <Button Command="{Binding Button4}" Background="{Binding BackColor4}"  Content="Test 4" Height="120" HorizontalAlignment="Left" Margin="347,-10,0,0" Name="MyInfo" VerticalAlignment="Top" Width="140" />


</Grid>

但我得到的错误是:-在类型“PhoneApplicationPage”中找不到可附加属性“Resources”


请告诉我如何解决这个问题。提前感谢。

由于您有一个
用户控件
,您应该在
中添加样式,而不是

<UserControl.Resources>
    <Style x:Key="ButtonStyle1" TargetType="Button">
        ........
        ........
    </Style>
</UserControl.Resources>

........
........