I have a form containing few TextBox elements and a progress bar. I want the progress bar to be updated when the TextBox have some values assigned.
I noticed that in WPF this can be achieved using BackgroundWorker, but this doesn't exist in WinRT
XAML:
<StackPanel>
<ProgressBar x:Name="progressBar1"
Value="{Binding ProgressPercent}"
HorizontalAlignment="Left"
IsIndeterminate="False"
Maximum="100" />
<TextBlock Text="Name" Grid.Column="0"/>
<TextBox x:Name="NameTextBox" Text="{Binding Name, Mode=TwoWay}"/>
<TextBlock Text="Data" Grid.Row="1" Grid.Column="0"/>
<DatePicker Date="{Binding Data, Mode=TwoWay}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Grid.Row="1"
Grid.Column="1"
CalendarIdentifier="GregorianCalendar"
Margin="0,8" />
<TextBlock Text="Address" Grid.Row="2" Grid.Column="0"/>
<TextBox x:Name="AddressTextBox"
Text="{Binding Address, Mode=TwoWay}"
Grid.Row="2"
Grid.Column="1"
Margin="0,5" />
<TextBlock Text="Email" Grid.Row="3" Grid.Column="0"/>
<TextBox x:Name="EmailTextBox"
Text="{Binding Email, Mode=TwoWay}"
Grid.Row="3"
Grid.Column="1"
Margin="0,5" />
</StackPanel>
ViewModel:
#region fields
private string progressPercent {get;set;}
#endregion
#region proprietes
public int ProgressPercent
{
get
{
return this.progressPercent;
}
set
{
this.progressPercent = value;
this.RaisePropertyChanged(() => this.ProgressPercent);
}
}
#endregion
How can this be achieved in WinRT? Most of the examples are for Wpf unfortunately
Each time one of the form's fields got updated a percent value needs to be added to the ProgressPercent property, i don't see the need for an async code, but if you insisted on that here how to do it