2017-05-09 114 views
1

我有一個xaml,它有一個帶有列表視圖和按鈕的網格,並且在 編譯時出現此錯誤: 錯誤:指定的轉換無效。錯誤:指定的轉換無效。 Xaml

我覺得問題可能出在這是網格內的列表視圖,但我還沒有真正能夠找到一個解決方案

這是我的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> 
+0

該消息是否說了更多?它通常會說從演員到演員試圖做什麼。僅基於這些信息很難說。 –

回答

0

問題

  1. 通常,您可能會在使用數據綁定時發現這些錯誤。雖然我們試圖將一個不同的類型綁定到編譯器並不完全期望的某些控件上。

有幾個地方我能找到的結合有點古怪 - ClassId="{Binding IdContacto}"

我不知道你是否正確或不具約束力。如果我是你,我會刪除所有ClassId綁定,然後繼續構建編譯過程。

  1. 另外我會嘗試註釋掉OnPlatform代碼並編譯/編譯/運行該項目。

這些是你可以嘗試的一些長鏡頭。看完整個Stacktrace後,我們可以對更確切的問題進行更多的診斷。

相關問題