Im trying to bind an ObservableCollection of
public class ProgressInfo : BindableBase, IProgress<Tuple<string, int>>
{
public ProgressInfo()
{
Message = "start";
ProgressBarValue = 50;
}
private string _message;
public string Message
{
get { return _message; }
set { _message = value; OnPropertyChanged(() => Message); }
}
private int _progressBarValue;
public int ProgressBarValue
{
get { return _progressBarValue; }
set { _progressBarValue = value; OnPropertyChanged(() => ProgressBarValue); }
}
public void Report(Tuple<string, int> value)
{
this.Message = value.Item1;
this.ProgressBarValue = value.Item2;
}
}
to WPF Toolkit BusyIndicator with custom content
<xctk:BusyIndicator DisplayAfter="0" IsBusy="{Binding IsBusy, Mode=OneWay}" >
<xctk:BusyIndicator.BusyContentTemplate>
<DataTemplate>
<StackPanel Margin="4">
<TextBlock Text="{x:Static lang:Resources.TRWAIMPORT}" FontWeight="Bold" HorizontalAlignment="Center"/>
<ItemsControl ItemsSource="{Binding ProgressInfos, UpdateSourceTrigger=PropertyChanged}" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Margin="4">
<TextBlock Text="{Binding ProgressInfo.Message, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay }"/>
<ProgressBar Value="{Binding Path=ProgressInfo.ProgressBarValue, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Height="15"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</DataTemplate>
</xctk:BusyIndicator.BusyContentTemplate>
<xctk:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</xctk:BusyIndicator.ProgressBarStyle>
Also I'm passing objects from the ObervableCollection to my Tasks so they change their properties through the Report method.
But for some reason the BusyIndicator is never updated with new values and the ObservableCollection seems to always be empty (ItemsControl doesn't produce any items)
What am I doing wrong ? This approach worked on any other control but the BusyIndicator seems it doesn't get it right