private static void OnIsExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TabbedExpanderView ep = (TabbedExpanderView)d;

            bool newValue = (bool)e.NewValue;

            // Fire accessibility event

            /*ExpanderAutomationPeer peer = UIElementAutomationPeer.FromElement(ep) as ExpanderAutomationPeer;
             * if(peer != null)
             * {
             *  peer.RaiseExpandCollapseAutomationEvent(!newValue, newValue);
             * }*/

            if (newValue)
            {
                ep.OnExpanded();
            }
            else
            {
                ep.OnCollapsed();
            }

            //ep.UpdateVisualState();
        }
示例#2
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            FrameworkElement element = container as FrameworkElement;

            TabbedExpanderView tabbedExpander = VisualTreeUtils.FindVisualParent <TabbedExpanderView>(element);

            if (tabbedExpander.Items.Count == 1)
            {
                return(Application.Current.Resources["ExpanderHeaderItemStyle"] as DataTemplate);
            }
            else
            {
                return(Application.Current.Resources["ExpanderHeaderItemsStyle"] as DataTemplate);
            }

            //return null;
        }