XAML analizar Excepción:Atributo {StaticResource PhoneAccentBrush} el valor está fuera de rango

StackOverflow https://stackoverflow.com/questions/5006100

Pregunta

Tengo un problema con una Excepción, no podía encontrar la respuesta sobre cómo solucionarlo.Atributo {StaticResource PhoneAccentBrush} el valor está fuera de rango.

System.Windows.Application.LoadComponent(this, new System.Uri("/PAK_phone_side;component/Views/About/App_info.xaml", System.UriKind.Relative));
        this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
        this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
        this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle")));
        this.PageTitle = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle")));
        this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
        this.textBlock1 = ((System.Windows.Controls.TextBlock)(this.FindName("textBlock1")));

En windows phone cuando hago clic en el botón App_info_Button la excepción ocurre en el Sistema.Windows.Apllication.LoadComponent En App_info.g.yo.cs , el código de arriba es de ese archivo.

aquí está el contenido del Panel de definición en App_info.xaml

 <phone:PhoneApplicationPage 
x:Class="windowsphoneapp.App_info"
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"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
shell:SystemTray.IsVisible="True">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="ApplicationTitle" Text="PAK " Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" Text="App Infos" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBlock Height="311" HorizontalAlignment="Center" Margin="25,32,0,0" Name="textBlock1" Text="This Application is designed ...." 
                   VerticalAlignment="Center" Width="425" Style="{StaticResource PhoneAccentBrush}" />
    </Grid>
</Grid>    
</phone:PhoneApplicationPage>

Esta es la traza de la Pila

en el Sistema.Windows.Aplicación.LoadComponent(componente de Objeto, Uri resourceLocator) en PAK_phone_side.App_info.InitializeComponent() en PAK_phone_side.App_info..cto r() en el Sistema.Reflexión.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr cuaderno Cuaderno, parámetros de Objeto CultureInfo cultura, Boolean isBinderDefault, Asamblea de llamadas, Boolean verifyAccess, StackCrawlMark& stackMark) en el Sistema.Reflexión.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr cuaderno Cuaderno, Object[] parámetros, CultureInfo cultura, StackCrawlMark& stackMark) en el Sistema.Activador.InternalCreateInstance(Tipo de tipo Boolean no pública, StackCrawlMark& stackMark) en el Sistema.Activador.CreateInstance(Tipo) en el Sistema.Windows.La navegación.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult resultado) en el Sistema.Windows.La navegación.PageResourceContentLoader.<>c_DisplayClass4.b_0(Objeto args) en el Sistema.Reflexión.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr cuaderno Cuaderno, parámetros de Objeto CultureInfo cultura, Boolean isBinderDefault, Asamblea de llamadas, Boolean verifyAccess, StackCrawlMark& stackMark) en el Sistema.Reflexión.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr cuaderno Cuaderno, Object[] parámetros, CultureInfo cultura, StackCrawlMark& stackMark) en el Sistema.Reflexión.MethodBase.Invocar(Object obj, Object[] parámetros) en el Sistema.El delegado.DynamicInvokeOne(Object[] args) en el Sistema.MulticastDelegate.DynamicInvokeImpl(Object[] args) en el Sistema.El delegado.DynamicInvoke(Object[] args) en el Sistema.Windows.Las operaciones de roscado.DispatcherOperation.Invoke() en el Sistema.Windows.Las operaciones de roscado.Despachador.Envío(DispatcherPriority prioridad) en el Sistema.Windows.Las operaciones de roscado.Despachador.OnInvoke(contexto del Objeto) en el Sistema.Windows.Hosting.CallbackCookie.Invoke(Object[] args) en el Sistema.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args) en el Sistema.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)

¿Fue útil?

Solución

El problema está en esta línea:

<TextBlock Height="311" HorizontalAlignment="Center" 
           Margin="25,32,0,0" Name="textBlock1" 
           Text="This Application is designed ...." 
           VerticalAlignment="Center" Width="425" 
           Style="{StaticResource PhoneAccentBrush}" />

Usted está tratando de establecer un cepillo de recursos de valor a un estilo, que es lo que está causando la excepción.Usted podría tratar de cambiar el XAML:

<TextBlock Height="311" HorizontalAlignment="Center" 
           Margin="25,32,0,0" Name="textBlock1" 
           Text="This Application is designed ...." 
           VerticalAlignment="Center" Width="425" 
           Style="{StaticResource PhoneTextNormalStyle}"
           Foreground="{StaticResource PhoneAccentBrush}" />
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top