【问题标题】:How to fix " The property is set more than once"?如何修复“该属性设置不止一次”?
【发布时间】:2019-10-28 07:21:22
【问题描述】:

在我的列表视图中,当我展开列表视图时,我想向许多控件显示,但是当我将 Isvisible 属性分配给标签时,我收到此错误“属性“文本”显示不止一次“

 <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:d="http://xamarin.com/schemas/2014/forms/design"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 mc:Ignorable="d"
                 x:Class="CpoLogin.MainPage">

            <ListView ItemsSource="{Binding Complains}"
                      HasUnevenRows="True"
                      Margin="40,80"
                      ItemTapped="ListView_ItemTapped">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout>
                            <Label Text="{Binding ComplainsTitle}"/>
                            <Label Text="Caller CNIC: 4220142488449"/>
                            <Label Text="Complaint Type: Emergency"/>
                            <Label Text="Notes: Gulshan-e-Iqal,Karachi"/>
                            <Label Text="Criminals Involved: 2"/>
                            <Label Text="Dead Count: 2"/>
                            <Label Text="Sub Type: Murder"/>
                            <Label Text="Criminal Appearance: 2"/>
                            <Label Text="Wounded Count: 2"/>
                            <Label Text="Vehicle Used: 2"
                                   IsVisible="{Binding IsVisible}/>



                            <Button Text="Details"
                                    IsVisible="{Binding IsVisible}"/>

                        </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>

            </ListView>

    </ContentPage>

【问题讨论】:

    标签: c# xamarin xamarin.forms


    【解决方案1】:

    @阿希尔汗

    请替换以下代码

    <Label Text="Vehicle Used: 2"
           IsVisible="{Binding IsVisible}" />
    

    您忘记关闭双引号,如果对您有帮助,请检查并接受答案。

    【讨论】:

      【解决方案2】:

      对按钮使用内容而不是文本。

      【讨论】:

      • 内容不适用于表单,它应该是纯文本。
      • 啊,我的错!我以为问题是关于 WPF 的。
      • 如果它可能的,现在这与所提出的问题有关。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多