Monday, November 23, 2009

How To Hide Some Class from New Button List/Navigation Item in XAF

public partial class HideItemsControll : WinNewObjectViewController
{
public HideItemsControll()
{
InitializeComponent();
RegisterActions(components);
}
protected override void OnActivated()
{
base.OnActivated();
CollectCreatableItemTypes += new EventHandler(HideItemsControll_CollectCreatableItemTypes);
}
void HideItemsControll_CollectCreatableItemTypes(object sender, CollectTypesEventArgs e)
{
CustomizeList(e.Types);

}
public void CustomizeList(ICollection types)
{
//Get the ShowNavigationItemController, then get its ShowNavigationItemAction
SingleChoiceAction showNavigationItemAction = Frame.GetController().ShowNavigationItemAction;
//Get the item selected in the navigation control
ChoiceActionItem selectedItem = showNavigationItemAction.SelectedItem;
ChoiceActionItem currentGroup = null;
if (selectedItem != null)
{
//Get the selected item's parent group
currentGroup = selectedItem.ParentItem;
List unusableTypes = new List();
//Collect the types that must be deleted
foreach (Type type in types)
{
//bool deletionRequired = true;
if (type.Name.Equals("BillByBill"))
{
unusableTypes.Add(type);
}
if (type.Name.Equals("AccountIntrest"))
{
unusableTypes.Add(type);
}
foreach (Type type in unusableTypes)
types.Remove(type);
}}}

No comments:

Post a Comment

Mat Table Angular

Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...