Hi,I'm using RadTreeListView,the default TreeListViewRow's IsExpanded Property is controled by a toggle button,right?
My question is:
when the IsSelected property is True,Could I give the IsExpanded property a True Value,too?It means the Row Expanded when I Selected the Row.
best wishes,
Sky
My question is:
when the IsSelected property is True,Could I give the IsExpanded property a True Value,too?It means the Row Expanded when I Selected the Row.
best wishes,
Sky
4 Answers, 1 is accepted
0
Hi Yu,
That way when a row is selected, it will be expanded.
Regards,
Didie
the Telerik team
You could do this like so:
private
void
tlv_SelectionChanged(
object
sender, SelectionChangeEventArgs e)
{
if
(e.AddedItems.Count > 0)
{
TreeListViewRow selectedRow =
this
.tlv.ItemContainerGenerator.ContainerFromItem(e.AddedItems[0])
as
TreeListViewRow;
if
(selectedRow !=
null
)
{
selectedRow.IsExpanded =
true
;
}
}
That way when a row is selected, it will be expanded.
Regards,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0

Yu
Top achievements
Rank 1
answered on 09 Dec 2011, 11:22 AM
Hello,
Thanks for your reply,and this works! Thank you very much.But,it only happens when the selection changes,how could it happens when the row is clicked?
Best Regards,
Sky
Thanks for your reply,and this works! Thank you very much.But,it only happens when the selection changes,how could it happens when the row is clicked?
Best Regards,
Sky
0
Accepted
Hello Yu,
I hope that this is what you need.
Best wishes,
Didie
the Telerik team
If you want to set the row properties when the row is clicked, then you should handle the click. I would suggest you something like this:
public MainWindow()
{...
this
.AddHandler(FrameworkElement.MouseDownEvent, newSystem.Windows.Input.MouseButtonEventHandler(OnMouseDown),
true
);
}
private void OnMouseDown(objectsender, MouseButtonEventArgs e)
{
var s = e.OriginalSource asFrameworkElement;
var parentRow = s.ParentOfType<GridViewRow>();
if
(parentRow !=
null
)
{... }
}
I hope that this is what you need.
Best wishes,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0

Yu
Top achievements
Rank 1
answered on 13 Dec 2011, 10:52 AM
Hello,
It's done! It works well!Thank you very much and best wishes to you and Telerik Team!
Sky
It's done! It works well!Thank you very much and best wishes to you and Telerik Team!
Sky