Esempio n. 1
0
        public ToolBarButtonProvider RemoveButtonAt(int index)
        {
            ToolBarButtonProvider button = null;

            if (index < toolBar.Buttons.Count)
            {
                button = (ToolBarButtonProvider)
                         ProviderFactory.GetProvider(toolBar.Buttons [index]);
                ProviderFactory.ReleaseProvider(toolBar.Buttons [index]);
            }

            return(button);
        }
Esempio n. 2
0
        public override void FinalizeChildControlStructure()
        {
            toolBar.Buttons.UIACollectionChanged -=
                new CollectionChangeEventHandler(OnCollectionChanged);

            for (int index = 0; index < toolBar.Buttons.Count; index++)
            {
                ToolBarButtonProvider buttonProvider
                    = (ToolBarButtonProvider)ProviderFactory.FindProvider(toolBar.Buttons [index]);
                RemoveChildProvider(buttonProvider);
            }
            OnNavigationChildrenCleared();

            base.FinalizeChildControlStructure();
        }
Esempio n. 3
0
                #pragma warning disable 169

        private void OnCollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            if (e.Action == CollectionChangeAction.Add)
            {
                ToolBarButtonProvider button = (ToolBarButtonProvider)
                                               ProviderFactory.GetProvider(toolBar.Buttons [(int)e.Element]);
                AddChildProvider(button);
            }
            else if (e.Action == CollectionChangeAction.Remove)
            {
                ToolBarButtonProvider button = RemoveButtonAt((int)e.Element);
                RemoveChildProvider(button);
            }
            else if (e.Action == CollectionChangeAction.Refresh)
            {
                ClearButtonsCollection();
                OnNavigationChildrenCleared();
            }
        }