예제 #1
0
        void AssociatedObject_LayoutUpdated(object sender, EventArgs e)
        {
            if (AssociatedObject == null || AssociatedObject.Items.Count == 0)
            {
                return;
            }

            GridViewHeaderRow headerRow = AssociatedObject.ChildrenOfType <GridViewHeaderRow>().FirstOrDefault();

            if (headerRow == null)
            {
                return;
            }

            this.AssociatedObject.LayoutUpdated -= new EventHandler(AssociatedObject_LayoutUpdated);
            this.frozenRowsContainer             = new RadGridView();
            GenerateHeader();
            SelectiveScrollingGrid grid = headerRow.ChildrenOfType <SelectiveScrollingGrid>().FirstOrDefault();

            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition());
            frozenRowsContainer.SetValue(Grid.RowProperty, 1);
            frozenRowsContainer.SetValue(Grid.ColumnSpanProperty, 4);
            frozenRowsContainer.SetValue(Grid.RowProperty, 1);
            frozenRowsContainer.ShowGroupPanel         = false;
            frozenRowsContainer.ShowColumnHeaders      = false;
            frozenRowsContainer.RowIndicatorVisibility = AssociatedObject.RowIndicatorVisibility;
            frozenRowsContainer.SetValue(SelectiveScrollingGrid.SelectiveScrollingOrientationProperty, SelectiveScrollingOrientation.Vertical);


            frozenRowsContainer.ItemsSource = this.PinnedItems;

            frozenRowsContainer.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Hidden);

            frozenRowsContainer.HorizontalAlignment = HorizontalAlignment.Left;


            grid.Children.Add(frozenRowsContainer);

            var scrollViewer = this.AssociatedObject.ChildrenOfType <GridViewScrollViewer>().FirstOrDefault();

            scrollViewer.ScrollChanged += new ScrollChangedEventHandler(scrollViewer_ScrollChanged);
            this.frozenRowsContainer.SetBinding(FrameworkElement.WidthProperty, new Binding("ActualWidth")
            {
                Source = headerRow
            });
            this.frozenRowsContainer.Margin = new Thickness(-1, 0, 0, 0);
            this.frozenRowsContainer.SetBinding(RadGridView.FrozenColumnCountProperty,
                                                new Binding("FrozenColumnCount")
            {
                Source = this.AssociatedObject, Mode = BindingMode.TwoWay
            });

            this.PinItem(AssociatedObject.Items[0]);
            this.PinItem(AssociatedObject.Items[1]);
            this.PinItem(AssociatedObject.Items[2]);
            this.PinItem(AssociatedObject.Items[3]);

            SyncColumnWidths();
        }
 public static IObservable <EventPattern <DataTransferEventArgs> > SourceUpdatedObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <EventHandler <DataTransferEventArgs>, DataTransferEventArgs>(h => This.SourceUpdated += h, h => This.SourceUpdated -= h));
 }
 public static IObservable <EventPattern <MouseButtonEventArgs> > MouseLeftButtonDownObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.MouseLeftButtonDown += h, h => This.MouseLeftButtonDown -= h));
 }
 public static IObservable <EventPattern <ContextMenuEventArgs> > ContextMenuClosingObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <ContextMenuEventHandler, ContextMenuEventArgs>(h => This.ContextMenuClosing += h, h => This.ContextMenuClosing -= h));
 }
 public static IObservable <EventPattern <ManipulationCompletedEventArgs> > ManipulationCompletedObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationCompletedEventArgs>, ManipulationCompletedEventArgs>(h => This.ManipulationCompleted += h, h => This.ManipulationCompleted -= h));
 }
 public static IObservable <EventPattern <ManipulationInertiaStartingEventArgs> > ManipulationInertiaStartingObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationInertiaStartingEventArgs>, ManipulationInertiaStartingEventArgs>(h => This.ManipulationInertiaStarting += h, h => This.ManipulationInertiaStarting -= h));
 }
 public static IObservable <EventPattern <RoutedEventArgs> > LostFocusObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.LostFocus += h, h => This.LostFocus -= h));
 }
 public static IObservable <EventPattern <RoutedEventArgs> > UnloadedObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.Unloaded += h, h => This.Unloaded -= h));
 }
 public static IObservable <EventPattern <KeyEventArgs> > KeyUpObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <KeyEventHandler, KeyEventArgs>(h => This.KeyUp += h, h => This.KeyUp -= h));
 }
 public static IObservable <EventPattern <KeyEventArgs> > PreviewKeyDownObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <KeyEventHandler, KeyEventArgs>(h => This.PreviewKeyDown += h, h => This.PreviewKeyDown -= h));
 }
 public static IObservable <EventPattern <RequestBringIntoViewEventArgs> > RequestBringIntoViewObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <RequestBringIntoViewEventHandler, RequestBringIntoViewEventArgs>(h => This.RequestBringIntoView += h, h => This.RequestBringIntoView -= h));
 }
 public static IObservable <EventPattern <StylusButtonEventArgs> > StylusButtonUpObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <StylusButtonEventHandler, StylusButtonEventArgs>(h => This.StylusButtonUp += h, h => This.StylusButtonUp -= h));
 }
 public static IObservable <EventPattern <StylusEventArgs> > LostStylusCaptureObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <StylusEventHandler, StylusEventArgs>(h => This.LostStylusCapture += h, h => This.LostStylusCapture -= h));
 }
 public static IObservable <EventPattern <StylusSystemGestureEventArgs> > PreviewStylusSystemGestureObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <StylusSystemGestureEventHandler, StylusSystemGestureEventArgs>(h => This.PreviewStylusSystemGesture += h, h => This.PreviewStylusSystemGesture -= h));
 }
 public static IObservable <EventPattern <StylusEventArgs> > StylusOutOfRangeObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <StylusEventHandler, StylusEventArgs>(h => This.StylusOutOfRange += h, h => This.StylusOutOfRange -= h));
 }
 public static IObservable <EventPattern <TouchEventArgs> > PreviewTouchUpObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <EventHandler <TouchEventArgs>, TouchEventArgs>(h => This.PreviewTouchUp += h, h => This.PreviewTouchUp -= h));
 }
 public static IObservable <EventPattern <TouchEventArgs> > TouchLeaveObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <EventHandler <TouchEventArgs>, TouchEventArgs>(h => This.TouchLeave += h, h => This.TouchLeave -= h));
 }
 public static IObservable <EventPattern <KeyboardFocusChangedEventArgs> > PreviewLostKeyboardFocusObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <KeyboardFocusChangedEventHandler, KeyboardFocusChangedEventArgs>(h => This.PreviewLostKeyboardFocus += h, h => This.PreviewLostKeyboardFocus -= h));
 }
 public static IObservable <EventPattern <EventArgs> > LayoutUpdatedObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <EventHandler, EventArgs>(h => This.LayoutUpdated += h, h => This.LayoutUpdated -= h));
 }
 public static IObservable <EventPattern <SizeChangedEventArgs> > SizeChangedObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <SizeChangedEventHandler, SizeChangedEventArgs>(h => This.SizeChanged += h, h => This.SizeChanged -= h));
 }
 public static IObservable <EventPattern <DependencyPropertyChangedEventArgs> > FocusableChangedObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <DependencyPropertyChangedEventHandler, DependencyPropertyChangedEventArgs>(h => This.FocusableChanged += h, h => This.FocusableChanged -= h));
 }
 public static IObservable <EventPattern <TextCompositionEventArgs> > TextInputObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <TextCompositionEventHandler, TextCompositionEventArgs>(h => This.TextInput += h, h => This.TextInput -= h));
 }
 public static IObservable <EventPattern <ManipulationBoundaryFeedbackEventArgs> > ManipulationBoundaryFeedbackObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationBoundaryFeedbackEventArgs>, ManipulationBoundaryFeedbackEventArgs>(h => This.ManipulationBoundaryFeedback += h, h => This.ManipulationBoundaryFeedback -= h));
 }
 public static IObservable <EventPattern <QueryContinueDragEventArgs> > QueryContinueDragObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <QueryContinueDragEventHandler, QueryContinueDragEventArgs>(h => This.QueryContinueDrag += h, h => This.QueryContinueDrag -= h));
 }
 public static IObservable <EventPattern <ToolTipEventArgs> > ToolTipClosingObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <ToolTipEventHandler, ToolTipEventArgs>(h => This.ToolTipClosing += h, h => This.ToolTipClosing -= h));
 }
 public static IObservable <EventPattern <GiveFeedbackEventArgs> > GiveFeedbackObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <GiveFeedbackEventHandler, GiveFeedbackEventArgs>(h => This.GiveFeedback += h, h => This.GiveFeedback -= h));
 }
 public static IObservable <EventPattern <MouseButtonEventArgs> > PreviewMouseUpObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.PreviewMouseUp += h, h => This.PreviewMouseUp -= h));
 }
 public static IObservable <EventPattern <DragEventArgs> > PreviewDragLeaveObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <DragEventHandler, DragEventArgs>(h => This.PreviewDragLeave += h, h => This.PreviewDragLeave -= h));
 }
 public static IObservable <EventPattern <DragEventArgs> > DropObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <DragEventHandler, DragEventArgs>(h => This.Drop += h, h => This.Drop -= h));
 }
 public static IObservable <EventPattern <QueryCursorEventArgs> > QueryCursorObserver(this SelectiveScrollingGrid This)
 {
     return(Observable.FromEventPattern <QueryCursorEventHandler, QueryCursorEventArgs>(h => This.QueryCursor += h, h => This.QueryCursor -= h));
 }