首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IValueConverter :找不到

IValueConverter :找不到
EN

Stack Overflow用户
提问于 2016-10-10 03:17:56
回答 1查看 272关注 0票数 0

我尝试使用在Xaml文件中声明的自定义IValueConverter。

转换器类是在EnglishKeyboard中定义的。在下面xaml内部的ResourceDictionary中声明的转换。我试着在下面的代码末尾使用这个转换器

代码语言:javascript
复制
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:local="clr-namespace:ProjectorRemote" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    x:Class="ProjectorRemote.EnglishKeyboard"
    x:Name="englishKeyboard">
<ContentView.Resources>
    <ResourceDictionary>

        <local:EnglishKeyboard.StringCaseConverter x:Key="caseConverter">
        </local:EnglishKeyboard.StringCaseConverter>

        <!-- lower 1 characters  -->
        <x:String x:Key="lower_1">q</x:String>
        <x:String x:Key="lower1_2">w</x:String>
        <x:String x:Key="lower1_3">e</x:String>
        <x:String x:Key="lower1_4">r</x:String>         
        <x:String x:Key="lower1_5">t</x:String>
        <x:String x:Key="lower1_6">y</x:String>
        <x:String x:Key="lower1_7">u</x:String>
        <x:String x:Key="lower1_8">i</x:String>
        <x:String x:Key="lower1_9">o</x:String>
        <x:String x:Key="lower1_0">p</x:String>

    </ResourceDictionary>
</ContentView.Resources>
<ContentView.Content>
    <StackLayout 
            Orientation="Vertical"  
            HorizontalOptions="Fill"
            VerticalOptions="End">

        <Grid HorizontalOptions="Center" ColumnSpacing="1">

            **<local:BaseKeyView
                Grid.Column="0" 
                Text="{StaticResource lower1_1, 
                    Converter={StaticResource caseConverter}, 
                    ConverterParameter={Binding IsUpper}}">
            </local:BaseKeyView>** 

它工作时没有错误,但是在我更改为下面的代码后,转换器没有被调用

代码语言:javascript
复制
<local:BaseKeyView
                Grid.Column="0" 
                Text="{StaticResource lower1_1, 
                    Converter={StaticResource caseConverter}, 
                    ConverterParameter={Binding IsUpper}}">
            </local:BaseKeyView>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-11 01:03:46

我用这个来解决这个问题

代码语言:javascript
复制
{Binding Source={StaticResource lower1_1}, Converter={ ..... –
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39950837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档