コード例 #1
0
        private static void Refresh(object sender)
        {
            var sv  = sender as ScrollViewer;
            var hfe = GetColumnHeader(sv);
            var hsv = BehaviorUtil.GetScrollViewer(hfe);
            var rfe = GetRowHeader(sv);
            var rsv = BehaviorUtil.GetScrollViewer(rfe);
            var hfo = GetColumnFooter(sv);
            var rfo = GetRowFooter(sv);

            if (hsv != null)
            {
                hsv.ScrollToHorizontalOffset(sv.HorizontalOffset);
            }
            if (rsv != null)
            {
                rsv.ScrollToVerticalOffset(sv.VerticalOffset);
            }
            if (hfo != null)
            {
                hfo.Width = GetScrollWidth(sv);
            }
            if (rfo != null)
            {
                rfo.Height = GetScrollHeight(sv);
            }
        }
コード例 #2
0
        /// <summary>
        /// ScrollViewerの処理
        /// </summary>
        /// <param name="action">スクロール移動処理</param>
        private static void OnScrollCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e, Action <ScrollViewer> action)
        {
            var sv = BehaviorUtil.GetScrollViewer(sender);

            if (sv != null)
            {
                action(sv);
            }
        }
コード例 #3
0
        /// <summary>
        /// ヘッダプロパティが変更された際の処理
        /// </summary>
        /// <param name="sender">対象</param>
        /// <param name="e">イベント情報</param>
        private static void OnHeaderCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var viewer = BehaviorUtil.GetScrollViewer(sender as FrameworkElement);

            BehaviorUtil.SetEventHandler(viewer,
                                         (sv) => sv.ScrollChanged += ScrollViewer_ScrollChanged,
                                         (sv) => sv.ScrollChanged -= ScrollViewer_ScrollChanged
                                         );

            var target = e.NewValue as FrameworkElement;

            BehaviorUtil.SetEventHandler(target,
                                         (sv) => sv.PreviewMouseWheel += FrameworkElement_MouseWheel,
                                         (sv) => sv.PreviewMouseWheel -= FrameworkElement_MouseWheel
                                         );

            BehaviorUtil.Loaded(viewer, ScrollViewer_Loaded);
        }