【发布时间】:2014-10-02 19:28:15
【问题描述】:
<Page x:Class="Myprog.StartPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Myprog"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="ItemTemplate2">
<Border BorderThickness="1" Height="36" Width="598" Margin="0 -5" Padding="2" BorderBrush="#FFE2E2E2">
<Grid Background="#eee" KeyDown="Grid_KeyDown_1">
<Grid.Resources>
<local:strConverter x:Name="sameera1"/>
</Grid.Resources>
<TextBlock TextWrapping="Wrap" Text="{Binding ProductDesc,Converter={StaticResource sameera1}}" Margin="0,0,227,0" Foreground="Black" Padding="6,5,0,0"/>
</Grid>
</Border>
</DataTemplate>
</Page.Resources>
and then other elements...
在我的代码中,我在名称空间 Myprog.StartPage 中定义了 strConverter 类。 startPage 是包含设计的页面。
我已经使用这个资源 strConverter 来修改“ProductDesc”的值。
<Grid.Resources>
<local:strConverter x:Name="sameera1"/>
</Grid.Resources>
编译时会显示以下错误消息..
命名空间“using:Myprog”中不存在名称“strConverter”。
我如何解决这个问题??
【问题讨论】:
-
strConverter 类的确切命名空间定义是什么?
-
命名空间是Myprog
-
等等,现在我看到了问题所在。写一个答案。
标签: xaml c#-4.0 windows-store-apps