private List <ScrollViewer> GetMixedGroupScrollViewers() { List <ScrollViewer> scrollViewers = new List <ScrollViewer>(); try { var items = PatternTwoList.Items; foreach (var item in items) { var grid = PatternTwoList.ItemContainerGenerator.ContainerFromItem(item); if (grid != null) { ScrollViewer scroll = WpfTreeHelper.FindChild <ScrollViewer>(grid); if (scroll == null) { continue; } scrollViewers.Add(scroll); } } } catch (Exception) { return(null); } return(scrollViewers); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); bd = GetTemplateChild("SelectTen") as Border; ContentPresenter cp = GetTemplateChild("contentPresenter") as ContentPresenter; _EditContent = GetTemplateChild("contentPresenter1") as ContentPresenter; if (_column.IsNotNull() && _column.Formatter.IsNotNull()) { var _b = BindingOperations.GetBinding(cp, ContentPresenter.ContentProperty); Binding newbind = new Binding { Converter = _column.Formatter, Path = _b.Path, Mode = _b.Mode, RelativeSource = _b.RelativeSource }; BindingOperations.ClearBinding(cp, ContentPresenter.ContentProperty); BindingOperations.SetBinding(cp, ContentPresenter.ContentProperty, newbind); } cp.ApplyTemplate(); tb = WpfTreeHelper.FindChild <AyText>(cp); if (tb.IsNotNull()) { tb.TextWrapping = CellTextWrapping; if (CellCharacterEllipsis == TextTrimming.CharacterEllipsis) { ToolTip tt = new System.Windows.Controls.ToolTip(); AyText ttb = new AyText(); ttb.SetBinding(AyText.TextProperty, new Binding { Source = cp.Content }); tt.Content = ttb; tb.ToolTip = tt; if (dpd != null) { dpd.AddValueChanged(tb, ActualWidthPropertyChangedHandler); } if (tb.ActualWidth < tb.DesiredSize.Width) { tt.Visibility = Visibility.Visible; } else { tt.Visibility = Visibility.Collapsed; } } tb.TextTrimming = CellCharacterEllipsis; } }
/// <summary> /// Initializes a new instance of the AutoScroller class. /// </summary> /// <param name="itemsControl">The ItemsControl that is scrolled.</param> /// <exception cref="ArgumentNullException">itemsControl is null.</exception> public AutoScroller(ItemsControl itemsControl) { if (itemsControl == null) { throw new ArgumentNullException("itemsControl"); } this.itemsControl = itemsControl; this.scrollViewer = WpfTreeHelper.FindChild <ScrollViewer>(itemsControl); this.scrollViewer.ScrollChanged += this.OnScrollChanged; this.scrollContent = WpfTreeHelper.FindChild <ScrollContentPresenter>(this.scrollViewer); this.autoScroll.Tick += delegate { this.PreformScroll(); }; this.autoScroll.Interval = TimeSpan.FromMilliseconds(GetRepeatRate()); }
private bool Register() { this.listBox.UpdateLayout(); this.scrollContent = WpfTreeHelper.FindChild <ScrollContentPresenter>(this.listBox); if (this.scrollContent != null) { this.autoScroller = new AutoScroller(this.listBox); this.autoScroller.OffsetChanged += this.OnOffsetChanged; var d = GetSelectionBrush(this.listBox); this.selectionRect = new AyTableViewSelectionAdorner(this.scrollContent, d); this.scrollContent.AdornerLayer.Add(this.selectionRect); this.selector = new AyTableViewItemsControlSelector(this.listBox); this.listBox.PreviewMouseLeftButtonDown += this.OnPreviewMouseLeftButtonDown; this.listBox.MouseLeftButtonUp += this.OnMouseLeftButtonUp; this.listBox.MouseMove += this.OnMouseMove; } return(this.scrollContent != null); }