Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Dynamically change the xaml of a Custom ViewCell after pressing a button

$
0
0

Hello,

I have a List View with that loads a custom DataTemplate. Everything works ok at loading: I am using a different ContentView for specific cells. My only problem is, when I want to change the xaml of the cell after pressing a button (after the cell is loaded).

Here is my command that does that (I have to add that it enters this method, I tested with a breackpoint):

  //Commands initialisation
  OnPlayButtonClicked = new Command (() => {
    if (boolValue) {
      this.View = new CustomCell1 ();
    } else {
      this.View = new CustomCell2 ();
    }
  });

P.S If I set the xaml before loading in OnBindingContextChanged, everything works but in the button action it doesn't change the view.

  if (c.Value.Equals ("True")) {
    this.View = new CustomCell1 ();
  } else {
    this.View = new CustomCell2 ();
    }

Thank you.


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>