Hello,
I tried to customize style TreeListViewRow to add behavior, but i met a problem to keep the default alternating row style (row white and grey)
Indeed, I Have the default alternating style in my RadTreeListView, but if I customize only the row style, I lost the alternating row style (all the row are white)
So I decide to customize also the alternating row style, based on the row style.
But with this, I lost also the alternating row background color
I set the background color of the style with bind of the AlternateRowBackground of the control (to keep inheritance).
With this, it's work, but I have binding error on each alternate line : BindingExpression path error: 'AlternateRowBackground' property not found on 'object' ''RelativeSource' (HashCode=46024298)'. BindingExpression:Path=AlternateRowBackground; DataItem='RelativeSource' (HashCode=46024298); target element is 'TreeListViewRow' (Name=''); target property is 'Background' (type 'Brush')
I undestand If the color work, it's because when binding fail, telerik engine seems to put the default value, because Value={Binding Foo or whatever produce the same result.
So I think it's because the AlternateRowBackground property isn't set in my RadTreeListView, I do this with yellow for test, but same error! (binding error, and the alternate background color is grey). I don't understand, can you explain this ?
Thanks,
Sincerly
Gourdon Julien
PS : sorry for my english, I'm french
I tried to customize style TreeListViewRow to add behavior, but i met a problem to keep the default alternating row style (row white and grey)
Indeed, I Have the default alternating style in my RadTreeListView, but if I customize only the row style, I lost the alternating row style (all the row are white)
So I decide to customize also the alternating row style, based on the row style.
<
Style
x:Key
=
"rowStyle"
BasedOn
=
"{StaticResource {x:Type telerik:TreeListViewRow}}"
TargetType
=
"{x:Type telerik:TreeListViewRow}"
>
<
Style.Setters
>
<
EventSetter
Event
=
"MouseDoubleClick"
Handler
=
"HandleRowDoubleClick"
/>
</
Style.Setters
>
</
Style
>
<
Style
x:Key
=
"alternateRowStyle"
BasedOn
=
"{StaticResource rowStyle}"
TargetType
=
"{x:Type telerik:TreeListViewRow}"
>
</
Style
>
But with this, I lost also the alternating row background color
I set the background color of the style with bind of the AlternateRowBackground of the control (to keep inheritance).
<
Style
x:Key
=
"alternateRowStyle"
BasedOn
=
"{StaticResource rowStyle}"
TargetType
=
"{x:Type telerik:TreeListViewRow}"
>
<
Style.Setters
>
<
Setter
Property
=
"Background"
Value
=
"{Binding AlternateRowBackground, Source={RelativeSource TemplatedParent}}"
/>
</
Style.Setters
>
</
Style
>
With this, it's work, but I have binding error on each alternate line : BindingExpression path error: 'AlternateRowBackground' property not found on 'object' ''RelativeSource' (HashCode=46024298)'. BindingExpression:Path=AlternateRowBackground; DataItem='RelativeSource' (HashCode=46024298); target element is 'TreeListViewRow' (Name=''); target property is 'Background' (type 'Brush')
I undestand If the color work, it's because when binding fail, telerik engine seems to put the default value, because Value={Binding Foo or whatever produce the same result.
So I think it's because the AlternateRowBackground property isn't set in my RadTreeListView, I do this with yellow for test, but same error! (binding error, and the alternate background color is grey). I don't understand, can you explain this ?
Thanks,
Sincerly
Gourdon Julien
PS : sorry for my english, I'm french