I have a RadGridView(with name RadGridWorkPlan) with three levels. I do not want to display Expand button (+) if the row do not have child items. I added a RowLoaded Event RadGridWorkPlan_RowLoaded. At first the RowLoaded even was firing for only the top level. I then after some self reserach added foolowing code on RadGridWorkPlan_DataLoading
private void RadGridWorkPlan_DataLoading(object sender, GridViewDataLoadingEventArgs e)
{
GridViewDataControl dataControl = (GridViewDataControl)sender;
if(dataControl.ParentRow != null)
{
dataControl.RowLoaded += new EventHandler<RowLoadedEventArgs>(RadGridWorkPlan_RowLoaded);
}
}
Now RadGridWorkPlan_RowLoaded is getting fired for all Rows.
Following is my RadGridWorkPlan_RowLoaded code
private void RadGridWorkPlan_RowLoaded(object sender, RowLoadedEventArgs e)
{
GridViewRow row = e.Row as GridViewRow;
if (row != null)
{
var workPlanSummary = row.DataContext as WorkPlanSummary;
if (workPlanSummary != null)
{
int count = -1;
if(workPlanSummary.ChildItems !=null)
count = workPlanSummary.ChildItems.Count;
bool isExp = count > 0;
if (!isExp)
{
row.IsExpandable = isExp;
row.Background = new SolidColorBrush(Colors.Red);
}
}
else
{
row.IsExpandable = false;
}
}
}
For the Parent Level, the code works fine.
For Lev 2 & 3 Rows, If the Row doesn't have any child items, the Row color is displayed Red but the expandable (+) is still shown for those items. I did line debuging and the row.IsExpandable does get set true or false based on the items. But isExpandable function is not working.
Can you give me suggestion or the fix.
Query #2
I also want to change the filter icon dynamically for certail columns. I saw a post for WPF. http://www.telerik.com/community/forums/wpf/gridview/changing-the-funnel-filter-icon.aspx
I would need a similar solution for Silverlight. Can you provide sample code as well on this.
Query #3.
As said in My Query#1, I have Hirerachical RadGrid. I donot want to show data on top level columns accept the Title column. If I remove the Databinding for the first lelel columns, the filter icons disapears.How do I accomplish this - I need the filter icons at the same time the data in the first level columns shouldn't be displayed.