Hi,
I do have a requirement, I have implemented a hierarchical datagridview, i have lots of data in some child grid and few data on some childgrid, now if the childgrid has more than 5 rows i want to have the vertical scrollbar enabled otherwise it should not have the scrollbar.
my issue, if the set the height of the grid as some 100, its getting set for all the grid, irrespective of whether data is there or not. which i dont want.
What i finally want is, if there are more than 5 rows, show 5 rows and enable the scrollbar. if there are less than 5 rows, the child grid placeholder should exactly fit in, the child grid place holder should not show the height of 5 rows.
Thanks,
Shiras
I do have a requirement, I have implemented a hierarchical datagridview, i have lots of data in some child grid and few data on some childgrid, now if the childgrid has more than 5 rows i want to have the vertical scrollbar enabled otherwise it should not have the scrollbar.
my issue, if the set the height of the grid as some 100, its getting set for all the grid, irrespective of whether data is there or not. which i dont want.
What i finally want is, if there are more than 5 rows, show 5 rows and enable the scrollbar. if there are less than 5 rows, the child grid placeholder should exactly fit in, the child grid place holder should not show the height of 5 rows.
Thanks,
Shiras
7 Answers, 1 is accepted
0
Ravi
Top achievements
Rank 1
answered on 15 Apr 2011, 01:59 PM
Please do let me know if you have any updates for this.
0
Hello David,
This may be hard to achieve , but not impossible .
I think I found a solution :
You may bind the height of the GridView to the items/ items count in the source .
You will need to implement a custom IValueConverter for this binding . Then inside the convert method you may check the items count.
In case rows are more than 5 - return a fixed height e.g. 100 , in case rows are less than 5 - return Auto height.
In case you have troubles implementing this ,just let me know and I will provide a small working sample for you .
Best wishes,
Pavel Pavlov
the Telerik team
This may be hard to achieve , but not impossible .
I think I found a solution :
You may bind the height of the GridView to the items/ items count in the source .
You will need to implement a custom IValueConverter for this binding . Then inside the convert method you may check the items count.
In case rows are more than 5 - return a fixed height e.g. 100 , in case rows are less than 5 - return Auto height.
In case you have troubles implementing this ,just let me know and I will provide a small working sample for you .
Best wishes,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Ravi
Top achievements
Rank 1
answered on 18 Apr 2011, 12:49 PM
Thanks for your great idea, Appreciate it.
Can you please provide me a working sample, As it will help me a lot.
Thanks,
Shiras
Can you please provide me a working sample, As it will help me a lot.
Thanks,
Shiras
0
Ravi
Top achievements
Rank 1
answered on 19 Apr 2011, 05:21 PM
Can you please provide a sample project as a reply to this post?
Thanks
Thanks
0
Ravi
Top achievements
Rank 1
answered on 20 Apr 2011, 02:02 PM
Appreciate your early response.
Thanks
Thanks
0
Hello David,
Please excuse me for the delayed answer, I am preparing a sample for you right now and will send it as soon as it is ready ( later today ) .
Regards,
Pavel Pavlov
the Telerik team
Please excuse me for the delayed answer, I am preparing a sample for you right now and will send it as soon as it is ready ( later today ) .
Regards,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Accepted
Hello David,
While preparing the sample for you I found even an easier and strightforward way .
Setting just the MaxHeight property of the child grid should do the trick . I have demonstrated this in the sample attached.
Child grids with more than 2 rows will show up vertical scrollbars. ( To have this adjusted to your requirement of 5 rows - just increase the value of MaxWidth).
Regards,
Pavel Pavlov
the Telerik team
While preparing the sample for you I found even an easier and strightforward way .
Setting just the MaxHeight property of the child grid should do the trick . I have demonstrated this in the sample attached.
Child grids with more than 2 rows will show up vertical scrollbars. ( To have this adjusted to your requirement of 5 rows - just increase the value of MaxWidth).
Regards,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items