I have a class, Kategori , which inherits from HCategory.
If I open a detail view the new action on the Children tab shows both HCategory and Kategori.
If i select new from the TreeListEditor it only shows Kategori.
I tried the approach suggested here: https://www.devexpress.com/Support/Center/Question/Details/Q108244
C#public partial class HideHCategoryViewController : ViewController
{
public HideHCategoryViewController()
{
InitializeComponent();
// Target required Views (via the TargetXXX properties) and create their Actions.
//RegisterActions(components);
this.TargetViewId = "HCategory_Children_ListView";
}
protected override void OnActivated()
{
base.OnActivated();
// Perform various tasks depending on the target View.
Frame.GetController<NewObjectViewController>().CollectCreatableItemTypes += HideHCategoryViewController_CollectCreatableItemTypes;
Frame.GetController<NewObjectViewController>().CollectDescendantTypes += HideHCategoryViewController_CollectDescendantTypes;
}
private void HideHCategoryViewController_CollectDescendantTypes(object sender, CollectTypesEventArgs e)
{
foreach (var item in e.Types)
{
if (item.GetType() == typeof(HCategory))
{
e.Types.Remove(item);
}
}
}
private void HideHCategoryViewController_CollectCreatableItemTypes(object sender, CollectTypesEventArgs e)
{
foreach (var item in e.Types)
{
if(item.GetType() == typeof(HCategory))
{
e.Types.Remove(item);
}
}
}
protected override void OnViewControlsCreated()
{
base.OnViewControlsCreated();
// Access and customize the target View control.
//Frame.GetController<NewObjectViewController>().CollectCreatableItemTypes += HideHCategoryViewController_CollectCreatableItemTypes;
//Frame.GetController<NewObjectViewController>().CollectDescendantTypes += HideHCategoryViewController_CollectDescendantTypes;
}
protected override void OnDeactivated()
{
// Unsubscribe from previously subscribed events and release other references and resources.
base.OnDeactivated();
}
}
If i put breakpoints in the two event handlers it never enters them.
Commenting out
C#this.TargetViewId = "HCategory_Children_ListView";
does nothing.
Moving
C#Frame.GetController<NewObjectViewController>().CollectCreatableItemTypes += HideHCategoryViewController_CollectCreatableItemTypes; Frame.GetController<NewObjectViewController>().CollectDescendantTypes += HideHCategoryViewController_CollectDescendantTypes;
to OnViewControlsCreated is not doing anything neither.
Any suggestions?
Terje
Forgot to add screenshot