Example #1
0
        private static void OnIsExpandedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataGridGroupHeader groupHeader = d as DataGridGroupHeader;
            var context = groupHeader.DataContext as GroupHeaderContext;

            if (context != null)
            {
                context.IsExpanded = (bool)e.NewValue;
            }

            groupHeader.UpdateVisualState(groupHeader.IsTemplateApplied);
            if (groupHeader.Owner != null)
            {
                groupHeader.Owner.OnGroupIsExpandedChanged();
            }
        }
Example #2
0
        private static void OnIsExpandedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataGridGroupHeader groupHeader = d as DataGridGroupHeader;
            var context = groupHeader.DataContext as GroupHeaderContext;

            if (context != null)
            {
                context.IsExpanded = (bool)e.NewValue;
            }

            groupHeader.UpdateVisualState(groupHeader.IsTemplateApplied);
            if (groupHeader.Owner != null)
            {
                groupHeader.Owner.OnGroupIsExpandedChanged();
            }

            var peer = FrameworkElementAutomationPeer.FromElement(groupHeader) as DataGridGroupHeaderAutomationPeer;

            if (peer != null)
            {
                peer.RaiseExpandCollapseAutomationEvent(!((bool)e.NewValue), (bool)e.NewValue);
            }
        }