Bug 41879 - The button in ViewCell cannot change Button.Image property with binding.
Summary: The button in ViewCell cannot change Button.Image property with binding.
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.2.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-16 03:41 UTC by Jesse Jiang
Modified: 2016-07-04 09:29 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Demo project (358.84 KB, application/zip)
2016-06-16 03:41 UTC, Jesse Jiang
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Jesse Jiang 2016-06-16 03:41:04 UTC
Created attachment 16352 [details]
Demo project

Build and run TestButtonImage solution for UWP. 
There are a listview and button in the first page. When you click the button in the bottom, you will see the image in button was changed. But the buttons in listview cannot change the image correctly.
Comment 1 Rui Marinho 2016-07-04 09:29:33 UTC
Hi, seems this is a problem with your sample. Your button on each cell is bound to the IsSelected of your Model IsSelected, but you aren't change that property anytime when you tap a row. 

To achieve what you need change the code to grab the model of the selected item and change it's IsSelected property like so:

	private void MainList_ItemTapped(object sender, ItemTappedEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine("I want get the tap event from ListView Item, not from the button in the Items");
			(this.MainList.SelectedItem as ItemModel).IsSelected = !(this.MainList.SelectedItem as ItemModel).IsSelected;
			this.MainList.SelectedItem = null;
		}