gpt4 book ai didi

xaml - WP7 - 在类型 'Resources' 中找不到可附加属性 'PhoneApplicationPage'

转载 作者:行者123 更新时间:2023-12-05 03:14:42 24 4
gpt4 key购买 nike

我正在尝试创建底栏。在此底部栏中有 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 ,您应该在 <UserControl.Resources> 内添加样式而不是 <phone:PhoneApplicationPage.Resources> :

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

关于xaml - WP7 - 在类型 'Resources' 中找不到可附加属性 'PhoneApplicationPage',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23491898/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com