Hello, my problem is that i want to have the list on UI that is bound to observable collection in page's view model and that observable collection has controls' view models inside. I want items in this list to be customized so i cant use ViewCells i guess.
Here is my code (full code available at github (cant post proper links) /ProtonSoftware/Timeinator/tree/Development/Patryk):
Page's view model:
public ObservableCollection TaskItems { get; set; } = new ObservableCollection();
Page's xaml:
<local:ItemsControl.ItemTemplate>
<DataTemplate>
<local:TimeTaskControl />
</DataTemplate>
</local:ItemsControl.ItemTemplate>
</local:ItemsControl>
Control's xaml:
<local:ContentControl.Resources>
<ResourceDictionary>
<ControlTemplate x:Key="ContentTemplate">
<Frame>
<StackLayout Orientation="Vertical">
<Label Text="{Binding Name}" />
</StackLayout>
</Frame>
</ControlTemplate>
</ResourceDictionary>
</local:ContentControl.Resources>
<local:ContentControl ControlTemplate="{StaticResource ContentTemplate}" />
Both "ItemsControl" and "ContentControl" are downloaded from microsoft's github as a substitute for the same controls that exist in WPF. (I tried with Listview and ContentView but it didnt work).
Now the problem is that - list is bound properly, if i have 3 vms in collection it displays 3 controls BUT these controls are empty and BindingContext of every control is null, even though collection is a list of view models that are proper for the control. How to fix that?