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

Style GridView indent cells using style selector approach?

13 Answers 213 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 03 Feb 2012, 07:24 AM

Hi, we've got a grid that is using a GroupRowStyleSelector to select a background colour for a group row style based on the index of the group in the grid, so group 1 will be Blue, group 2 will be Red, and so on.

Using a style selector here is great because we can dynamically populate the styles from application resources.

We would ideally like the indent cell to match the group row background, but there is no StyleSelector available on the grid view for indent cells, as far as I can see. 

I've looked at the existing ways of styling the indent cells, but I couldn't see anything that would work in this instance.

Is this scenario possible with the RadGridView? If so, can you provide a sample?

Thanks,

Sam

13 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Feb 2012, 07:29 AM
Hi Sam,

 I believe you can achieve this if you use both GroupRowStyleSelector and RowStyleSelector. You need to style indent cells (modify RowStyle in Blend) and return your custom style when needed using RowStyleSelector.

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sam
Top achievements
Rank 1
answered on 05 Feb 2012, 11:49 PM

Hi Vlad,

Can you provide a quick example of how to style the indent cell? I don't see how to control this, and it's very difficult to understand from googling.

I can do the RowStyleSelector once I know how to target the background property of the indent cell.

Thanks,

Sam
0
Vlad
Telerik team
answered on 06 Feb 2012, 09:11 AM
Hello Sam,

It will be better to check our documentation instead googling. 

All the best,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Sam
Top achievements
Rank 1
answered on 06 Feb 2012, 11:01 PM
Thanks Vlad, I've already read that page (courtesy of Google) - I'd really like an example if at all possible, as I'm not making any progress by myself.
0
Vlad
Telerik team
answered on 07 Feb 2012, 08:54 AM
Hello,

 Can you clarify what you don't understand in the article? Do you have any problems with Blend?

Regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Sam
Top achievements
Rank 1
answered on 07 Feb 2012, 11:52 PM
Hi Vlad,

We don't have Blend licenses available so I can't use Blend.

In order to be able to use a RowStyleSelector, I have to be able to provide a style that targets the GridViewRow type. I already have templates extracted for all the GridView elements as we have created our own theme, so I can easily create a new style in code based on the original style, or even modify the base template if required to allow easier styling of the group indent cell.

What I don't understand is how to target the GridViewIndentCell style within the GridViewRow style - I've looked at the template and all I can see is an IndentPresenter.

I know I can create an implicit style for the GridViewIndentCell, but this won't work with RowStyleSelector as I can't return styles that target GridViewIndentCell. I need to return a GridViewRow style that somehow also targets the GridViewIndentCell with a specific background brush, and this is what I can't work out.

Thanks,

Sam


0
Vlad
Telerik team
answered on 08 Feb 2012, 08:54 AM
Hello,

 Unfortunately I'm afraid that without Blend you can do very little in both Silverlight and WPF. You can only copy/paste someone else XAML or even try to guess using the intellisece of Visual Studio - both definitively not recommended for any serious development. 

Regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Sam
Top achievements
Rank 1
answered on 08 Feb 2012, 11:13 PM
Hi Vlad,

Look, you're not being very helpful here. You obviously have access to Blend, so there is no reason why you can't help me out - the other moderators on this forum seem able to. Don't just say, if you don't have Blend then I can't help you, because that's a really poor attitude to have.

For the record, I've done pretty well so far without Blend access, and am not entirely limited to copy and paste as you say, but there are times when it is impossible to work out how to customize the Telerik controls, even when you have all the XAML and documentation available.

If you don't know how to help me or you aren't prepared to provide a sample then please refer my request to another moderator.

Thanks,

Sam


0
Simon
Top achievements
Rank 1
answered on 03 Sep 2012, 07:32 PM
Sam, I feel for you.
We have the same problem and the answers are certainly NOT forthcoming.
Did you get a resolution?
Telerik are normally very helpful, but unfortunately not in this case. Documentation is of little help.
0
Sam
Top achievements
Rank 1
answered on 03 Sep 2012, 11:11 PM

Hi Simon, no unfortunately we never found a solution to this problem - we ended up changing our UI design to use colour in a different way that didn't require group row / indent restyling.

I was able to create a control template for GridViewRow that included an implicit style for targetting GridViewIndentCell, as this control is populated one or more times by an IndentPresenter. However, I couldn't find a way to make this more generic via a RowStyleSelector - I would have had to create a specific GridViewRow control template with matching GridViewIndentCell implicit style for every colour we wanted to use, which was unmanageable.

Hope you have more luck!

Sam
0
Maya
Telerik team
answered on 05 Sep 2012, 07:15 AM
Hi guys,

Generally, all styles and templates are shipped together with the controls and you can easily get them from your local installations. Still, working with Blend is the way to go if you want to create some more complex templates. 
Considering styling the indent cells, you can try working with NoXAML assemblies and define implicit styles as illustrated in our documentation.

All the best,
Maya
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Simon
Top achievements
Rank 1
answered on 05 Sep 2012, 09:31 PM
Thanks Maya,

You probably need to post somewhere that there is a bug with your controls re this..

In your words Maya..."As it turns out, the issue with GridViewGroupPanelItem is a kind of known one. For the time being the way to go would be to work with NoXAML binaries and define implicit style as illustrated in our documentation
I would recommend you to follow the same approach with GridViewIndentCell as well.
 

This explains Sam why we never got a working example! :-)

 Unfortunately we're flat out trying to get our product to market, so having to go through this to simply style a small part of a grid is not really time efficient. We'll probably just leave it and wait for this fix? Why can't these PARTs be exposed as a dependency property. Make life much easier!

Thanks
Simon

0
Maya
Telerik team
answered on 06 Sep 2012, 06:53 AM
Hi guys,

Actually, the issue has been logged in our Public Issue Tracking System and you can follow its progress here. I have raised its priority so that it gets higher in our to-do list.


Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Sam
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Sam
Top achievements
Rank 1
Simon
Top achievements
Rank 1
Maya
Telerik team
Share this question
or