listviewxamarinitemsource

Xamarin set ItemSources to a List in a different dll


I have a project for Xamarin. I have my logic in a GameBrain.dll (a normal C# dll I share with a WPF project) and in there I have a public static List<Puzzle> Puzzles

Then I have the Xamarin forms project where I have my view that looks like this:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:local ="clr-namespace:GameBrainControl;assembly=GameBrain"
         x:Class="GB.AutoPuzzlesPage">

    <ListView ItemsSource="{x:Static local:Game}">
      <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <Label Text="{Binding Name}"/>
            </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>

</ContentPage>

and I get Syntax for x:Static is [Member=][prefix:]typeName.staticMemberName What's the proper syntax to reference my List ???


Solution

  • Assuming:

    This gives the syntax:

    <ListView ItemsSource="{x:Static local:Game.Puzzles}">
    ...