Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Invalid XAML. Can't find the issue...

$
0
0

Hey guys.
I think I'm seriously blind. The LoadFromXAML function in the .g.cs file is firing a target invocation exception. My thinking is that there is something fishy in my XAML, but i cant seem to find it. I'm rather certain that the XAML is messed up as other pages load without any errors. I would appreciate someone having a look.
XAML:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:conv="clr-namespace:Test.Converters"
             x:Class="Test.TasksView"
             x:Name="this"
             BindingContext="{x:Reference this}">
    <StackLayout>
        <Label Text="Tasks"
               Style="{StaticResource LabelLarge}" 
               HorizontalOptions="CenterAndExpand" 
               VerticalOptions="Start"/>
        <ListView ItemsSource="{Binding MyViewModel.Tasks}"
                  ItemSelected="CancelSelection">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout Orientation="Vertical"
                                     VerticalOptions="StartAndExpand">
                            <StackLayout Orientation="Horizontal">
                                <Label Text="Task: "
                                       Style="{StaticResource LabelMedium}"/>
                                <Label Text="{Binding Name}" 
                                       Style="{StaticResource LabelMedium}"/>
                            </StackLayout>
                            <StackLayout>
                                <Label Text="Task description: " 
                                       Style="{StaticResource LabelMedium}"/>
                                <Label Text="{Binding Description}"/>
                            </StackLayout>
                            <StackLayout Orientation="Horizontal">
                                <Label Text="Due: " 
                                       Style="{StaticResource LabelMedium}"/>
                                <Label Text="{Binding DueDate, StringFormat='{0:dd-MMM-yy}'}" 
                                       Style="{StaticResource LabelMedium}"/>
                            </StackLayout>
                            <StackLayout Orientation="Horizontal">
                                <Label Text="Done: " 
                                       HorizontalOptions="Start" 
                                       Style="{StaticResource LabelMedium}"/>
                                <Switch IsToggled="{Binding Completed}"
                                        HorizontalOptions="Start"/>
                                <Button Text="Delete Task" 
                                        HorizontalOptions="EndAndExpand"
                                        Command="{Binding Source={x:Reference this}, 
                                                          Path=MyViewModel.RemoveItem}"
                                        CommandParameter="{Binding .}"/>
                            </StackLayout>
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
            <ListView.Footer>
                <StackLayout Orientation="Horizontal">
                    <Button Text="Add New Task" 
                            Command="{Binding AddItem }"/>
                    <Button Text="Save Tasks"
                            Command="{Binding Source={x:Reference this},
                                              Path=MyViewModel.SaveList}"
                            CommandParameter="{Binding MyViewModel.Tasks}"/>
                </StackLayout>
            </ListView.Footer>
        </ListView>
    </StackLayout>
</ContentPage>

Thanks in advance :)


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>