示例#1
0
        public void Visit(DataGridContext sourceContext, int sourceDataItemIndex, object item, ref bool stopVisit)
        {
            if (!m_isTableFlowView)
            {
                m_item = item;
                m_parentDataGridContext = sourceContext;
                m_success = true;
                stopVisit = true;
                return;
            }

            UIElement dataRow = sourceContext.CustomItemContainerGenerator.ContainerFromItem(item) as UIElement;

            if (dataRow != null)
            {
                if (!ScrollTip.IsItemInView(dataRow, sourceContext.DataGridControl.ItemsHost))
                {
                    stopVisit = true;
                }
                else if (!ScrollTip.IsDataItemHiddenBySticky(sourceContext, item))
                {
                    m_item = item;
                    m_parentDataGridContext = sourceContext;
                    m_success = true;
                    stopVisit = true;
                }
            }
        }
示例#2
0
        private static void ParentGridControlPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            DataGridControl oldParentGridControl = e.OldValue as DataGridControl;
            DataGridControl parentGridControl    = e.NewValue as DataGridControl;
            ScrollTip       scrollTip            = sender as ScrollTip;

            scrollTip.IsInParentGridChanged = true;
            try
            {
                if (oldParentGridControl != null)
                {
                    if (scrollTip.UsingDefaultScrollTipContentTemplate)
                    {
                        // Unload DefaultTemplate
                        Nequeo.Wpf.DataGrid.Views.UIViewBase uiViewBase = oldParentGridControl.GetView() as Nequeo.Wpf.DataGrid.Views.UIViewBase;

                        if (uiViewBase != null)
                        {
                            uiViewBase.ClearValue(UIViewBase.ScrollTipContentTemplateProperty);
                            scrollTip.UsingDefaultScrollTipContentTemplate = false;
                        }
                    }

                    if (scrollTip.m_mainColumn != null)
                    {
                        PropertyChangedEventManager.RemoveListener(scrollTip.m_mainColumn, scrollTip, "DisplayMemberBinding");
                    }

                    scrollTip.m_mainColumn = null;

                    scrollTip.UnregisterListeners(oldParentGridControl);
                }

                if (parentGridControl == null)
                {
                    return;
                }

                scrollTip.PrepareDefaultStyleKey(parentGridControl.GetView());

                // Assert Template is applied in order to be notified for ScrollBars events
                DataGridControl.SetDataGridContext(scrollTip, parentGridControl.DataGridContext);

                if (!scrollTip.ApplyTemplate())
                {
                    scrollTip.RefreshDefaultScrollTipContentTemplate();
                }

                scrollTip.RegisterListeners(parentGridControl);
            }
            finally
            {
                scrollTip.IsInParentGridChanged = false;
            }
        }
示例#3
0
        private static void OnDataGridContextPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ScrollTip scrollTip = ( ScrollTip )sender;

            DataGridContext oldItemContext = e.OldValue as DataGridContext;
            DataGridContext newItemContext = e.NewValue as DataGridContext;

            if (scrollTip.m_mainColumn != null)
            {
                PropertyChangedEventManager.RemoveListener(scrollTip.m_mainColumn, scrollTip, "DisplayMemberBinding");
            }

            scrollTip.m_mainColumn = null;

            if (oldItemContext != null)
            {
                PropertyChangedEventManager.RemoveListener(oldItemContext.Columns, scrollTip, "MainColumn");
            }

            scrollTip.ClearValue(ScrollTip.ContentProperty);

            if (newItemContext != null)
            {
                scrollTip.m_mainColumn = newItemContext.Columns.MainColumn;

                if (scrollTip.m_mainColumn != null)
                {
                    PropertyChangedEventManager.AddListener(scrollTip.m_mainColumn, scrollTip, "DisplayMemberBinding");
                }

                PropertyChangedEventManager.AddListener(newItemContext.Columns, scrollTip, "MainColumn");
            }

            if (!scrollTip.IsInParentGridChanged)
            {
                if (!scrollTip.ApplyTemplate())
                {
                    scrollTip.RefreshDefaultScrollTipContentTemplate();
                }
            }
        }