错误:指定的演员表无效。 XAML

时间:2017-05-09 22:06:49

标签: xamarin xamarin.forms

我有一个xaml,它有一个带有listview和按钮的网格,并且在 出现编译此错误的时刻: 错误:指定的演员表无效。

我认为问题可能出在网格内的列表视图中,但我还没有真正找到解决方案

这是我的xaml:

<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="FCR.App.Views.AdvanceSearchResultPage" Title="AdvanceSearchResultPage" xmlns:extended="clr-namespace:FCR.App.ExtendedClasses;assembly=FCR.App">
    <ContentPage.Padding>
        <OnPlatform x:TypeArguments="Thickness" iOS="0, 10, 0, 0" WinPhone="20,20,20,20" />
    </ContentPage.Padding>
    <ContentPage.Content>
        <StackLayout VerticalOptions="StartAndExpand">
            <ContentView IsVisible="false" x:Name="TitleHC">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.5*" />
                        <ColumnDefinition Width="9.5*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Image Source="blue_circle.png" Grid.Column="0" />
                    <StackLayout Padding="0,4,0,5" VerticalOptions="Fill" Grid.Column="1">
                        <Label VerticalOptions="CenterAndExpand" TextColor="#0368b1" Text="Histórico de conéxiones" FontSize="20">
                            <Label.FontFamily>
                                <OnPlatform x:TypeArguments="x:String">
                                    <OnPlatform.iOS>FrutigerLTStd-Cn</OnPlatform.iOS>
                                    <OnPlatform.Android>FrutigerLTStd-Cn.otf#FrutigerLTStd-Cn</OnPlatform.Android>
                                </OnPlatform>
                            </Label.FontFamily>
                        </Label>
                    </StackLayout>
                </Grid>
            </ContentView>
            <ContentView IsVisible="false" x:Name="TitleHM">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.5*" />
                        <ColumnDefinition Width="9.5*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Image Source="blue_circle.png" Grid.Column="0" />
                    <StackLayout Padding="0,4,0,5" VerticalOptions="Fill" Grid.Column="1">
                        <Label VerticalOptions="CenterAndExpand" TextColor="#0368b1" Text="Histórico de módificaciones" FontSize="20">
                            <Label.FontFamily>
                                <OnPlatform x:TypeArguments="x:String">
                                    <OnPlatform.iOS>FrutigerLTStd-Cn</OnPlatform.iOS>
                                    <OnPlatform.Android>FrutigerLTStd-Cn.otf#FrutigerLTStd-Cn</OnPlatform.Android>
                                </OnPlatform>
                            </Label.FontFamily>
                        </Label>
                    </StackLayout>
                </Grid>
            </ContentView>
            <Grid VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <ContentView x:Name="contentListView" IsVisible="true" Padding="0,10,0,0" BackgroundColor="White" Grid.Row="0">
                    <ListView x:Name="resultListView" BackgroundColor="White" HasUnevenRows="true" HorizontalOptions="FillAndExpand" SeparatorVisibility="None">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <ViewCell.View>
                                        <StackLayout BackgroundColor="White" Padding="0" Opacity="90">
                                            <ContentView Padding="1,0,1,1" BackgroundColor="Gray">
                                                <Grid
                                                    BackgroundColor="White">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="0.7*">
                                                        </ColumnDefinition>
                                                        <ColumnDefinition Width="0.15*">
                                                        </ColumnDefinition>
                                                        <ColumnDefinition Width="0.15*">
                                                        </ColumnDefinition>
                                                    </Grid.ColumnDefinitions>
                                                    <StackLayout Grid.Column="0">
                                                        <Label Margin="-5" Text="{Binding NombreCompleto}" TextColor="Gray" Font="Bold,13" />
                                                        <Label Margin="-5"
                                                            Text="{Binding OrganizacionMayusculas}" TextColor="Gray" FontSize="13" />
                                                        <Label Margin="-5" Text="{Binding Region}" TextColor="Gray" FontSize="13" />
                                                    </StackLayout>
                                                    <Label Margin="0,0,0,2" Text="Detalle" Grid.Column="1"
                                                        Font="Bold, 13" ClassId="{Binding IdContacto}" TextColor="Gray" VerticalOptions="End">
                                                        <Label.FontFamily>
                                                            <OnPlatform x:TypeArguments="x:String" iOS="8">
                                                                <OnPlatform.iOS>FrutigerLTStd-BoldCn</OnPlatform.iOS>
                                                                <OnPlatform.Android>FrutigerLTStd-BoldCn.otf#FrutigerLTStd-BoldCn</OnPlatform.Android>
                                                            </OnPlatform>
                                                        </Label.FontFamily>
                                                        <Label.GestureRecognizers>
                                                            <TapGestureRecognizer Tapped="OnTapGestureRecognizerDetail" />
                                                        </Label.GestureRecognizers>
                                                    </Label>
                                                    <Label Margin="0,0,0,2" Text="Borrar" Grid.Column="2"
                                                        Font="Bold, 13" ClassId="{Binding IdContacto}" TextColor="Gray" VerticalOptions="End">
                                                        <Label.FontFamily>
                                                            <OnPlatform x:TypeArguments="x:String" iOS="8">
                                                                <OnPlatform.iOS>FrutigerLTStd-BoldCn</OnPlatform.iOS>
                                                                <OnPlatform.Android>FrutigerLTStd-BoldCn.otf#FrutigerLTStd-BoldCn</OnPlatform.Android>
                                                            </OnPlatform>
                                                        </Label.FontFamily>
                                                        <Label.GestureRecognizers>
                                                            <TapGestureRecognizer Tapped="OnTapGestureRecognizerDelete" />
                                                        </Label.GestureRecognizers>
                                                    </Label>
                                                </Grid>
                                            </ContentView>
                                        </StackLayout>
                                    </ViewCell.View>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </ContentView>
                <StackLayout>
                    <extended:CustomButton Text="Volver" Grid.Row="1" x:Name="dismissbutton" Clicked="OnDismissButtonClicked" WidthRequest="100" Style="{StaticResource buttonStyle}" />
                </StackLayout>
            </Grid>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

1 个答案:

答案 0 :(得分:0)

问题

  1. 通常在处理数据绑定时可能会发现这些错误。虽然我们试图将一个不同的类型绑定到编译器并不完全期望的某些控件上。
  2. 有几个地方我可以找到绑定有点奇怪 - ClassId="{Binding IdContacto}"

    我不确定你是否正确绑定。如果我是你,我会删除所有ClassId绑定,然后继续构建编译过程。

    1. 我还会尝试注释OnPlatform代码并构建/编译/运行项目。
    2. 这些是你可以尝试的一些长镜头。在查看整个Stacktrace之后,我们将能够针对确切的问题进行更多诊断。