Hi,
I have a button which opens the Camera using a class called CameraModel. This is done with a Binding Command.
Button to open Camera:
Part of CameraModel.cs:
Besides that, I also have a ListView with several items. I use ItemTapped, where only one of the items performs something when tapped:
Now I face the following problem as you already see in the previous picture:
I want to call CameraModel.cs from one specific ListView Item.
For example:
Text1
Text2
Text3
Text4
Text5
When ‘Text3’ is tapped, you can see that the DisplayAlert will show something, but now I want to add that when I tap ‘Text4’ the Camera will be opened (using CameraModel).
I have no idea how to add the Binding Command to one specific ListView Item, or how to change the code so that a Binding Command is not needed.
How can I do this?
Hope someone can help.
Regards, Ganesh
CameraModel is no need any more , move the logic into Page ,check my sample below .
Deleting bin and obj folder would decrease the attachment size .
Answers
If we want to remain the logic in command ,what we should do
Create a button in listview.item and binding Command on it .
Inside command function implement different logic depends on the index in the itemsource .
It is a bit complex, i suggest you remove Command and move the logic into
ItemTapped
event .Xaml
Code behind
Hi ColeX,
Thanks for the response.
I think I didn't explain my issue well enough. I'm sorry for that. Please look at the code example in the attachment (I made this example for Android). This is a RAR-file, because ZIP was too large.
You can see the button for opening the camera, including asking for permissions. Now I want to remove this button and open the camera when I tap on Text3 in the ListView. I have no idea how to do that.
I hope my issue is clear now.
Regards, Ganesh
CameraModel is no need any more , move the logic into Page ,check my sample below .
Deleting bin and obj folder would decrease the attachment size .