Hi,
I was trying to customize the RadGridView by using a control template. Basically, I wanted to always include an additional control together with the grid.
The first thing I noticed was, the ContentPresenter control doesn't do what it should, that is, the RadGridView does not get rendered. Then I tried to add another RadGridView to the control template, and have its properties bound to the container RadGridView through TemplateBindings or Bindings, but, for example, I cannot do this for the columns.
Has anyone succeeded in doing this? If so, what is the best approach? Could visual states be the answer?
Thanks,
RP
9 Answers, 1 is accepted
There is an option to add some custom content via predefining the template of RadGridView.
However it depends where this custom content should be placed - either inside or outside of GridViewScrollViewer.
Can you please verify this one?
Based on this info I will prepare small sample project, which illustrates the desired approach.
Regards,
Vanya Pavlova
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Hi, Vanya!
Thanks for your reply! What I was looking was a way to have a RadProgressBar at the bottom (outside) of the RadGridView that, depending on some condition, would appear as to indicate that the grid's content was loading.
Can you do that?
Thanks!
RP
You may define simple layout with RadGridView and RadProgressBar similar to the following:
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"*"
/>
<
RowDefinition
Height
=
"auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadGridView
ItemsSource
=
"{Binding Collection}"
/>
<
telerik:RadProgressBar
Grid.Row
=
"1"
/>
</
Grid
>
Then you could bind Visibility property of the progress bar to some property of your view model.
Using this approach you do not have to predefine the template of RadGridView to achieve the desired effect.
Regards,
Vanya Pavlova
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Hi, Vanya!
Yes, I know that! :-)
But what I wanted to do was, in *every location* where I have a RadGridView, also have the RadProgressBar. And I think the only way is through a control template (or subclassing, but by subclassing I can't be sure that I can add the RadProgressBar below the RadGridView).
RP
You may find attached sample demo that illustrates how to embed a progress bar within the template of RadGridView.
Hope this helps.
Regards,
Vanya Pavlova
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Hello again!
Thanks for your example, but I already knew how to do that... it works for automatically created columns, but not for explicitly declared ones. I mentioned that on my first post.
RP
Since the progress bar is outside of the grid's scrollviewer it does not matter how you define the columns. All columns are inside RadGridView's GridViewScrollViewer. In order to avoid any additional round trips please share with us some snapshot with the desired final result.
I look forward to hearing from you.
Regards,
Vanya Pavlova
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Well, I don't have a screenshot, but I don't think you understood my problem! :-)
If I specify some columns, say:
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Property1}"/>
<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding Property2}"/>
</telerik:RadGridView.Columns>
It does show these two columns, but appends all of the automatically columns to the grid, which is what I don't want.
RP
Sorry, it does work! I just need to set AutoGenerateColumns to False!
Thanks for your help! I really apreciate it!
Best regards,
RP