How can i expose RadTreeView.SelectedContainer property, which will return my own custom type instead of RadTreeViewItem?
code:
public RadTreeViewItem SelectedContainer
{
get { return (RadTreeViewItem)TreeView.GetValue(RadTreeView.SelectedContainerProperty); }
set { TreeView.SetValue(RadTreeView.SelectedContainerProperty, value); }
}
instead of the above code i want to write something like this:
public TngTreeViewItem SelectedContainer
{
get { return (TngTreeViewItem )TreeView.GetValue(RadTreeView.SelectedContainerProperty); }
set { TreeView.SetValue(RadTreeView.SelectedContainerProperty, value); }
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------TngTreeViewItem.cs
[
ContentProperty("Items")]
public class TngTreeViewItem : FrameworkContentElement
{
protected RadTreeViewItem _treeViewItem = new RadTreeViewItem();
#region
Constructors
static TngTreeViewItem()
{
DefaultStyleKeyProperty.OverrideMetadata(
typeof(TngTreeViewItem), new FrameworkPropertyMetadata(typeof(TngTreeViewItem)));
}
#endregion
#region
Internal Control
public RadTreeViewItem InternalControl
{
get
{
return _treeViewItem;
}
}
#endregion
#region
Property: Header
public virtual Object Header
{
get { return GetValue(HeaderProperty); }
set { SetValue(HeaderProperty, value); }
}
public static readonly DependencyProperty HeaderProperty =
DependencyProperty.Register(
"Header", typeof(Object), typeof(TngTreeViewItem),
new FrameworkPropertyMetadata
{
PropertyChangedCallback = (obj, e) =>
{
(obj
as TngTreeViewItem).UpdateHeader(e.NewValue);
}
});
private void UpdateHeader(Object sel)
{
_treeViewItem.Header = sel;
}
#endregion
}}
Thanks,
-Manjurekar