StaticResource AppName的问题

404*_*_ML 0 silverlight xaml windows-phone-7

<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="ApplicationTitle" 
                   Text="{StaticResource AppName}" 
                   Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" 
                   Text="Save Info" 
                   Margin="9,-7,0,0" 
                   Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>
Run Code Online (Sandbox Code Playgroud)

资源"AppName"无法解决,任何想法?

Der*_*kin 5

你需要在某个地方定义它.通常,这在App.xaml中如下:

<Application ...
             xmlns:sys=clr-namespace:System;assembly=mscorlib">
    <Application.Resources>
        <ResourceDictionary>
            <sys:String x:Key="AppName">My Application Title</sys:String>
    ...
Run Code Online (Sandbox Code Playgroud)