Ash*_*ali 9 c# xaml ivalueconverter valueconverter windows-phone-8
下面是我的App.xaml
<Application
x:Class="SpinrWindowsMobile.App"
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"
>
<!--Application Resources-->
<Application.Resources >
<ResourceDictionary>
<local:LocalizedStrings xmlns:local="clr-namespace:SpinrWindowsMobile" x:Key="LocalizedStrings"/>
<converter:TextColorConverter xmlns:converter="clr-namespace:SpinrWindowsMobile.Common" x:Key="TextColorConverter"></converter:TextColorConverter>
</ResourceDictionary>
</Application.Resources>
....
</Application>
Run Code Online (Sandbox Code Playgroud)
我在NameSpace SpinrWindowsMobile.Common中编写了TextColorConverter.cs, 同时启动应用程序它给我异常无法创建类型SpinrWindowsMobile.Common.TextColorConverter的实例.我不知道我错过了哪里.下面是我的TextColorConverter.cs类
class TextColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// some code
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// some code
}
}
Run Code Online (Sandbox Code Playgroud)
我使用Microsoft Visual Studio 2012 for Windows Phone作为我的开发工具.我要分享的另一件事我没有在System.Windows.Data命名空间中获得ValueConverstionAttribute类.任何人都可以指导我在哪里错了.
| 归档时间: |
|
| 查看次数: |
5274 次 |
| 最近记录: |