读书人

wp7的Text=quot;{StaticResource AppName}

发布时间: 2012-04-12 15:46:35 作者: rapoo

wp7的Text="{StaticResource AppName}" 问题!
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="ageTitle"

Text="Save Info"

Margin="9,-7,0,0"

Style="{StaticResource PhoneTextTitle1Style}"/>

</StackPanel>
复制代码error提示:“The resource "AppName" could not be resolved, ”
我已经在APP里定义了
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="ageTitle"

Text="Save Info"

Margin="9,-7,0,0"

Style="{StaticResource PhoneTextTitle1Style}"/>

</StackPanel>
复制代码error提示:“The resource "AppName" could not be resolved, ”
然后我就在App.xaml里定义了:
xmlns:system="clr-namespace:System;assembly=mscorlib
<Application.Resources>
<system:String x:Key="AppName">CONTROLS & NAVIGATION</system:String>
</Application.Resources>
但是为什么在XMAL那边还是有蓝色的波纹下划线呢?
这是怎么回事?
高手指点!



[解决办法]
根据我亲自实验

XML code
xmlns:system="clr-namespace:System;assembly=mscorlib<Application.Resources>  <system:String x:Key="AppName">CONTROLS & NAVIGATION</system:String></Application.Resources> 

读书人网 >Windows Mobile

热点推荐