I'm trying to apply row styles to my RadTreeListView depending on the hierarchy level of the row. Basically, I want all top level rows to be have a bold font weight, but all other rows to be normal. Below is the StyleSelector I am using:
However, I get a NullReferenceException when trying to access the Level property of the TreeListViewRow. This is the stack trace:
What am I doing wrong?
Thanks,
Andrew
public class RowStyleSelector : StyleSelector
{
public Style TopLevelRowStyle { get; set; }
public Style DetailRowStyle { get; set; }
public override Style SelectStyle(object item, DependencyObject container)
{
if (container.GetType() == typeof(TreeListViewRow))
{
TreeListViewRow row = (TreeListViewRow)container;
if (row.Level == 0)
return TopLevelRowStyle;
else
return DetailRowStyle;
}
return DetailRowStyle;
}
}
However, I get a NullReferenceException when trying to access the Level property of the TreeListViewRow. This is the stack trace:
What am I doing wrong?
Thanks,
Andrew