My list view looks like as below. As you can see my datatemplate has just a label which binds the object item itself. This works perfectly fine when it list is loaded but then I have a button on the page, when I click the button, it makes changes on "Items" object. I am not able to refresh these changes even though I raise property changed event as shown below. It looks like that UI is not refreshing. I am not stepping into my converter "ItemLogInfoConvertor". How can I achieve this?
<sfListView:SfListView x:Name="listItems"
RowSpacing="5"
ItemsSource="{Binding Items}" SelectionMode="Single" SelectedItem="{Binding SelectedItem}"
SwipeThreshold="250" SwipeOffset="250" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
ItemSpacing="1" IsStickyHeader="True" IsStickyFooter="False"
AllowSwiping="True" IsEnabled="True" AllowGroupExpandCollapse="False" AutoFitMode="Height" Loaded="listItems_Loaded">
<sfListView:SfListView.DataSource>
<data:DataSource>
<data:DataSource.GroupDescriptors>
<data:GroupDescriptor PropertyName="ItemNumber" />
</data:DataSource.GroupDescriptors>
</data:DataSource>
</sfListView:SfListView.DataSource>
<sfListView:SfListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid BackgroundColor="#4CA1FE">
<Label Text="{Binding Key,Converter={StaticResource ItemCountConvertor},ConverterParameter={resx:Translate Item,IsUpper=True}}"
FontSize="Small"
TextColor="White"
HorizontalTextAlignment="Start"
VerticalTextAlignment="Center"
Margin="20,0,0,0" />
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</sfListView:SfListView.GroupHeaderTemplate>
<sfListView:SfListView.LayoutManager>
<sfListView:LinearLayout />
</sfListView:SfListView.LayoutManager>
<OnPlatform x:TypeArguments="x:Double">
<OnPlatform.Android>
<OnIdiom x:TypeArguments="x:Double" Phone="180" Tablet="150" />
</OnPlatform.Android>
<OnPlatform.iOS>
<OnIdiom x:TypeArguments="x:Double" Phone="180" Tablet="150" />
</OnPlatform.iOS>
<OnPlatform.WinPhone>
<OnIdiom x:TypeArguments="x:Double" Phone="180" Tablet="150" Desktop="200" />
</OnPlatform.WinPhone>
</OnPlatform>
</sfListView:SfListView.ItemSize>-->
<sfListView:SfListView.ItemTemplate>
<DataTemplate>
<Frame OutlineColor="Silver" HasShadow="True" Margin="2,2" BackgroundColor="Transparent" VerticalOptions="FillAndExpand" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds=".5,.5,1,1" >
<Label HorizontalOptions="CenterAndExpand" FormattedText="{Binding .,Converter={StaticResource ItemLogInfoConvertor}, Mode=OneWay}" LineBreakMode="NoWrap" />
</Frame>
</DataTemplate>
</sfListView:SfListView.ItemTemplate>
</sfListView:SfListView>
In ViewModel
public Command SaveClick
{
get
{
return new Command(async () =>
{
try
{
var success = await SaveData();
if (success == false)
{
var data= getData();
Items = new ObservableCollection<Item>(data);
}
}
catch (Exception ex)
{
}
});
}
}
private ObservableCollection<Item> items;
public ObservableCollection<Item> Items
{
get
{
if (items == null)
items = new ObservableCollection<Item>();
return workoutSetWeightLogs;
}
set
{
if (value != null)
{
items = value;
RaisePropertyChanged("Items"); // not sure if is even needed
}
}
}