This is a migrated thread and some comments may be shown as answers.

Hide TileGroup using MVVM

3 Answers 33 Views
TileList
This is a migrated thread and some comments may be shown as answers.
Rémi
Top achievements
Rank 1
Rémi asked on 12 Jan 2016, 03:35 PM

Hi,

I would like to hide a TileGroup depending on a property in my ViewModel, I mean something like this :

<telerik:TileGroup Header="Header" Visibility={Binding MyProperty, Converter={StaticResource BooleanToVisibility}} />

Is there a way to achieve this ?

 

Thanks,

Rémi.

3 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 14 Jan 2016, 01:03 PM
Hi Rémi,

Unfortunately, there is no Visibility property of the TileGroup which value you can directly use for binding. Can you please clarify what exactly your intentions are? Would you like to hide the Group header or all the items within this specific group?  

If you would like to set the visibility of all items within a certain group, you can use an approach similar to the following one:
foreach (var item in this.TileList.Items)
   {
       var actualItem = item as Tile;
       if (actualItem.Group.Header.ToString() == "Group1")
       {
           actualItem.Visibility = Visibility.Collapsed;
       }  
   }

Rémi, please provide more details on the behavior you are aiming for so we can consider the different options. I have attached a sample project to my reply. You can modify it so that it reflects your setup and send it over so we can further advise.

I am looking forward to your reply.

Regards,
Stefan Nenchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Rémi
Top achievements
Rank 1
answered on 14 Jan 2016, 02:06 PM

Hi Stefan,

I would like to hide the entire group, I mean the GroupHeader and the Tiles within. I wish to perform this to use only Xaml bound by a business property (as I illustrated in my first post) but I guess it's not possible at the moment.

How could I perform this if I want to respect the MVVM pattern ?

Rémi.

0
Stefan Nenchev
Telerik team
answered on 19 Jan 2016, 11:00 AM
Hello Rémi,

As advised, It will not be possible to achieve this through XAML only as there is no such property of the TileGroup that you can use. However, you should be able to achieve the desired behavior through commands which will not break the MVVM principles in any way. I have refactored the sample project so that it hides the group through a command instead of using the code behind and also hiding the group header.

Regards,
Stefan Nenchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TileList
Asked by
Rémi
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Rémi
Top achievements
Rank 1
Share this question
or