繁体   English   中英

如何解决“该属性设置不止一次”?

[英]How to fix “ The property is set more than once”?

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

 <?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>

@阿希尔汗

请替换以下代码

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM