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

Need help on ConditionalDataTemplateSelector

1 Answer 129 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Heiko
Top achievements
Rank 1
Iron
Veteran
Heiko asked on 19 Apr 2017, 04:32 PM

Hi!

When I create a ConditionalDataTemplateSelector to use as CellTemplateSelector in a GridView, I have to specify the name of the field in my DataTemplateRule like this:

<telerik:ConditionalDataTemplateSelector x:Key="PriceSelectedSelector">
        <telerik:DataTemplateRule Condition="IsSelected = False OR IsSelected = null" Template="t1" />
        <telerik:DataTemplateRule Condition="IsSelected = True" Template="t2" />
</telerik:ConditionalDataTemplateSelector>

But if I have a lot of columns that are just true/false I have to create a new ConditionalTemplateSelector for each and every column. Is there a way to build this in a more general way like "If the value in this cell is true, take template t1" so I could use my ConditionalTemplateSelector on different columns regardless of the name of the field?

Regards
Heiko

1 Answer, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 24 Apr 2017, 08:08 AM
Hello Heiko,

Please have a look at the following article - CellTemplateSelector and consider implementing the approach suggested there. Eventually, you can set each column's CellTemplateSelector property to achieve the behavior you are looking for.

Regards,
Stefan Nenchev
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Heiko
Top achievements
Rank 1
Iron
Veteran
Answers by
Stefan Nenchev
Telerik team
Share this question
or