Hello,
I'm working on a framework that is supposed to provide improvements to WPF controls. This framework also provides features for Telerik controls.
I would like to make a behavior that bring an item of a TreeView into view when it is (programmatically) selected.
The problem is, on the layer I'm working on, I have no idea of the path of the object to bring into the view (Because I don't know the associated view model). Basically I have the following method to implement in the behavior:
All I know is that dataItem is an item of the treeview. It can be collapsed and have no associated TreeViewItem yet. As far as I understand, under this situation I have to use the BringPathIntoView.
It is not a problem if I have to iterate through the whole graph of items, but I have to find the path of the item that was passed to this method. I can get the value of the TextSearch.TextPathProperty attached to the tree view, which can help me to construct the path of each item.
But how can I iterate through the children of a given item, since the children collection is defined by the HierarchicalDataTemplate used by the TreeViewItem that might be unrealized?
Thanks
I'm working on a framework that is supposed to provide improvements to WPF controls. This framework also provides features for Telerik controls.
I would like to make a behavior that bring an item of a TreeView into view when it is (programmatically) selected.
The problem is, on the layer I'm working on, I have no idea of the path of the object to bring into the view (Because I don't know the associated view model). Basically I have the following method to implement in the behavior:
protected
override
void
BringIntoView(
object
dataItem)
{
// TODO: bring dataItem into the view of the AssociatedObject treeview
}
All I know is that dataItem is an item of the treeview. It can be collapsed and have no associated TreeViewItem yet. As far as I understand, under this situation I have to use the BringPathIntoView.
It is not a problem if I have to iterate through the whole graph of items, but I have to find the path of the item that was passed to this method. I can get the value of the TextSearch.TextPathProperty attached to the tree view, which can help me to construct the path of each item.
But how can I iterate through the children of a given item, since the children collection is defined by the HierarchicalDataTemplate used by the TreeViewItem that might be unrealized?
Thanks