Windows Mopbile 7 - Update controls after data change

I have a listbox which is bound to a Job object.  A button on the form marks the job as complete.  There are a number of fields which are displayed if the job is complete but hidden otherwise.

I am using DataBinding to set the visibility of these controls as required as I am displaying a list of jobs within a listbox and am only marking a specific job as complete.  I use a converter to set the visibility of the controls based on the Job property 'IsCompllete'

My question is - how do I force a refresh of the Job when I click the Complete button - in old Windows forms I would be doing a DataBind()?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Reset the Data by settings the ItemsSource to your "Jobs"
ChrisMDrewAuthor Commented:
My DataSource is set at the ListBox level and contains a number of jobs.  When I click COMPLETE I read the job, mark it as complete, update my underlying Job object and then set the datasource for the Jobs List again - nothing happens...
either a) Set the listbox itemssource to null and then to your list
or Call Lst.UpdateLayout() af the Setting of the datsoource
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

ChrisMDrewAuthor Commented:
Still doesn't seem to do anything - any other suggestions?
Can you do both?

Reset your items in  the Listbox
and then UpdateLayout()


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I take it, it worked :)
ChrisMDrewAuthor Commented:
Unfortunately I thiought that it had but it hasn't completely.

My list box is defined as :-

<ListBox x:Name="lbJobPictures" Width="450" Height="800">
      <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
      <Image Source="{Binding Image}" Width="250" Stretch="Uniform" HorizontalAlignment="Center" />
      <Button Content="Delete" Tag="{Binding fileName}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="180" Name="bnDelete" Click="bnDelete_Click" HorizontalContentAlignment="Center" Margin="20,0,0,0"/>
                                          <TextBlock Text="{Binding fileName}"></TextBlock>

I want to delete a picture so my code looks like the following button handler:-

private void bnDelete_Click(object sender, RoutedEventArgs e)
	if (MessageBox.Show("Are you sure that you want to delete this picture?" ,"Confirm Delete" ,MessageBoxButton.OKCancel) == MessageBoxResult.OK)
		// Get the existing dataSource
		JobPhotosList listJobPhotos = (JobPhotosList)lbJobPictures.ItemsSource;
		Button button = sender as Button;
		string fileName = button.Tag as string;
		var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
		if (isoFile.FileExists(fileName))

			// Update whereabouts

			// refresh data source
			lbJobPictures.ItemsSource = null;
			lbJobPictures.ItemsSource = _whereabouts.Jobs[_jobIndex].Pictures;

Open in new window

The list box does refresh so that if I had 3 pictures and 3 buttons displayed I now see just 2 buttons but no images get displayed - I guess that they need to get refreshed somehow also...
Are the file names correct for the image?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Smartphone Programming

From novice to tech pro — start learning today.