Domanda

Ho un problema con un'Eccezione, non riusciva a trovare la risposta su come risolvere il problema.Attributo {StaticResource PhoneAccentBrush} valore è compreso nell'intervallo.

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")));

In windows phone quando faccio clic sul pulsante App_info_Button l'eccezione si verifica nel Sistema.Windows.Apllication.LoadComponent In App_info.g.io.cs , il codice di cui sopra è da quel file.

ecco il contenuto del Pannello di definizione 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>

Questa è la traccia dello Stack

a Sistema.Windows.Applicazione.LoadComponent(componente di Oggetto, Uri resourceLocator) a PAK_phone_side.App_info.InitializeComponent() a PAK_phone_side.App_info..ctor() a Sistema.La riflessione.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder Binder, parametri Oggetto, CultureInfo cultura, Boolean isBinderDefault, Montaggio chiamante, Boolean verifyAccess, StackCrawlMark& stackMark) a Sistema.La riflessione.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder Binder, Object[] parametri, CultureInfo cultura, StackCrawlMark& stackMark) a Sistema.Attivatore.InternalCreateInstance(Tipo tipo Boolean non pubbliche, StackCrawlMark& stackMark) a Sistema.Attivatore.CreateInstance(Tipo) a Sistema.Windows.La navigazione.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult risultato) a Sistema.Windows.La navigazione.PageResourceContentLoader.<>c_DisplayClass4.b_0(Object arg) a Sistema.La riflessione.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder Binder, parametri Oggetto, CultureInfo cultura, Boolean isBinderDefault, Montaggio chiamante, Boolean verifyAccess, StackCrawlMark& stackMark) a Sistema.La riflessione.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder Binder, Object[] parametri, CultureInfo cultura, StackCrawlMark& stackMark) a Sistema.La riflessione.MethodBase.Invoke(Object obj, Object[] parameters) a Sistema.Delegato.DynamicInvokeOne(Object[] args) a Sistema.MulticastDelegate.DynamicInvokeImpl(Object[] args) a Sistema.Delegato.DynamicInvoke(Object[] args) a Sistema.Windows.La filettatura.DispatcherOperation.Invoke() a Sistema.Windows.La filettatura.Dispatcher.Spedizione(DispatcherPriority priorità) a Sistema.Windows.La filettatura.Dispatcher.OnInvoke(Oggetto di contesto) a Sistema.Windows.Di Hosting.CallbackCookie.Invoke(Object[] args) a Sistema.Windows.Di Hosting.DelegateWrapper.InternalInvoke(Object[] args) a Sistema.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)

È stato utile?

Soluzione

Il problema è in questa riga:

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

Si sta tentando di impostare un pennello valore di risorsa per uno stile, che è ciò che sta causando l'eccezione.Si potrebbe provare a modificare il codice XAML per:

<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}" />
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top