本文整理汇总了C#中System.Windows.Controls.ScrollChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ScrollChangedEventArgs类的具体用法?C# ScrollChangedEventArgs怎么用?C# ScrollChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScrollChangedEventArgs类属于System.Windows.Controls命名空间,在下文中一共展示了ScrollChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnScrollChanged
/// <summary>
/// Fix horizontal offset on scrolling changes.
/// </summary>
/// <param name="e"></param>
protected override void OnScrollChanged(ScrollChangedEventArgs e)
{
//if( e.HorizontalChange != 0 )
this.ScrollToHorizontalOffset(fixedHorizontalOffset);
base.OnScrollChanged(e);
}
示例2: HandleScrollChanged
void HandleScrollChanged (object sender, ScrollChangedEventArgs e)
{
if (Value != scrollValue) {
scrollValue = Value;
Context.InvokeUserCode (EventSink.OnValueChanged);
}
}
示例3: DataGrid2_ScrollChanged
private void DataGrid2_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (e.HorizontalChange != 0.0f)
{
ScrollViewer sv = null;
Type t = DataGrid2.GetType();
try
{
sv = t.InvokeMember("InternalScrollHost", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, DataGrid1, null) as ScrollViewer;
sv.ScrollToHorizontalOffset(e.HorizontalOffset);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
if (e.VerticalChange != 0.0f)
{
ScrollViewer sv = null;
Type t = DataGrid2.GetType();
try
{
sv = t.InvokeMember("InternalScrollHost", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, DataGrid1, null) as ScrollViewer;
sv.ScrollToVerticalOffset(e.VerticalOffset);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
示例4: ScrollViewer_ScrollChanged
private static void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) {
if (e.VerticalChange != 0 || e.HorizontalChange != 0) {
var changedScrollViewer = sender as ScrollViewer;
Scroll(changedScrollViewer);
}
}
示例5: AutoScrollListBox_ScrollChanged
private void AutoScrollListBox_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
try
{
var scrollViewer = sender as ScrollViewer;
if (scrollViewer == null)
{
return;
}
var ratio = scrollViewer.VerticalOffset / scrollViewer.ScrollableHeight;
if (ratio >= 0.9)
//if (scrollViewer.VerticalOffset >= scrollViewer.ScrollableHeight)
{
if (LazyLoadCommand != null && LazyLoadCommand.CanExecute(null))
{
LazyLoadCommand.Execute(null);
}
}
//Debug.WriteLine(scrollViewer.HorizontalOffset + " / " + scrollViewer.ScrollableWidth + " -- " + scrollViewer.VerticalOffset + " / " + scrollViewer.ScrollableHeight + " (" + (scrollViewer.VerticalOffset / scrollViewer.ScrollableHeight) + ")");
}
catch (Exception ex)
{
Debug.WriteLine("AutoScrollListBox_ScrollChanged: " + ex);
throw;
}
}
示例6: RichTextBox_ScrollChanged
/// <summary>
/// Method synchronizes vertical scrollbar in RichTextBoxes components
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RichTextBox_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
var textToSync = (sender == richTextBoxLines) ? richTextBoxNumbers : richTextBoxLines;
textToSync.ScrollToVerticalOffset(e.VerticalOffset);
textToSync.ScrollToHorizontalOffset(e.HorizontalOffset);
}
示例7: ScrollViewer_ScrollChanged
private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
var scrollViewer = (ScrollViewer)sender;
// User scroll event : set or unset autoscroll mode
if (e.ExtentHeightChange == 0)
{ // Content unchanged : user scroll event
if (scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight)
{ // Scroll bar is in bottom
// Set autoscroll mode
_autoScroll = true;
}
else
{ // Scroll bar isn't in bottom
// Unset autoscroll mode
_autoScroll = false;
}
}
// Content scroll event : autoscroll eventually
if (_autoScroll && e.ExtentHeightChange != 0)
{ // Content changed and autoscroll mode set
// Autoscroll
scrollViewer.ScrollToVerticalOffset(scrollViewer.ExtentHeight);
}
}
示例8: svSetCategoryGroupDisplay_ScrollChanged
private void svSetCategoryGroupDisplay_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
ScrollViewer sv = sender as ScrollViewer;
bSetCategoryGroupDisplayHorizontal.Width = sv.ViewportWidth * sv.ViewportWidth / sv.ExtentWidth;
bSetCategoryGroupDisplayVertical.Height = sv.ViewportHeight * sv.ViewportHeight / sv.ExtentHeight;
bSetCategoryGroupDisplayHorizontal.Margin = new Thickness(sv.ViewportWidth * sv.HorizontalOffset / sv.ExtentWidth, 0, 0, 0);
bSetCategoryGroupDisplayVertical.Margin = new Thickness(0, sv.ViewportHeight * sv.VerticalOffset / sv.ExtentHeight, 0, 0);
bOpacityLayerLeft.Visibility = bOpacityLayerRight.Visibility = System.Windows.Visibility.Visible;
if (bSetCategoryGroupDisplayHorizontal.Width >= sv.ViewportWidth)
bOpacityLayerLeft.Visibility = bOpacityLayerRight.Visibility = System.Windows.Visibility.Collapsed;
else if (bSetCategoryGroupDisplayHorizontal.Margin.Left <= 0)
bOpacityLayerLeft.Visibility = System.Windows.Visibility.Collapsed;
else if (bSetCategoryGroupDisplayHorizontal.Margin.Left + bSetCategoryGroupDisplayHorizontal.Width >= sv.ViewportWidth)
bOpacityLayerRight.Visibility = System.Windows.Visibility.Collapsed;
bOpacityLayerTop.Visibility = bOpacityLayerBottom.Visibility = System.Windows.Visibility.Visible;
if (bSetCategoryGroupDisplayVertical.Height >= sv.ViewportHeight)
bOpacityLayerTop.Visibility = bOpacityLayerBottom.Visibility = System.Windows.Visibility.Collapsed;
else if (bSetCategoryGroupDisplayVertical.Margin.Top <= 0)
bOpacityLayerTop.Visibility = System.Windows.Visibility.Collapsed;
else if (bSetCategoryGroupDisplayVertical.Margin.Top + bSetCategoryGroupDisplayVertical.Height >= sv.ViewportHeight)
bOpacityLayerBottom.Visibility = System.Windows.Visibility.Collapsed;
}
示例9: OnScrollChanged
protected override void OnScrollChanged(ScrollChangedEventArgs e)
{
HorizontalPosition = HorizontalOffset;
VerticalPosition = VerticalOffset;
HorizontalMax = ScrollableWidth;
VerticalMax = ScrollableHeight;
}
示例10: ScrollViewer_ScrollChanged
public void ScrollViewer_ScrollChanged( object sender, ScrollChangedEventArgs ev )
{
if ( ev.Source.GetType( ) == typeof( ScrollViewer ) ) {
return;
}
// Calculate scrollbar situation before the scroll change
double oldVh = ev.ViewportHeight - ev.ViewportHeightChange;
double oldVo = ev.VerticalOffset - ev.VerticalChange;
double oldEh = ev.ExtentHeight - ev.ExtentHeightChange;
var oldNeeded = ( oldEh >= oldVh );
var oldAtBottom = Math.Abs( ( oldVh + oldVo ) - oldEh ) < 0.01;
// Calculate scrollbar situation after the scroll change
double newVh = ev.ViewportHeight;
double newVo = ev.VerticalOffset;
double newEh = ev.ExtentHeight;
var newNeeded = ( newEh >= newVh );
var newAtBottom = Math.Abs( ( newVh + newVo ) - newEh ) < 0.01;
if ( ( !oldNeeded && newNeeded ) || ( oldAtBottom && !newAtBottom ) ) {
Dispatcher.BeginInvoke( (Action) ScrollViewer.ScrollToBottom );
}
}
示例11: OnScrollChanged
protected override void OnScrollChanged(ScrollChangedEventArgs e)
{
base.OnScrollChanged(e);
var panel = Content as Panel;
if (panel == null)
{
return;
}
var viewport = new Rect(new Point(0, 0), RenderSize);
foreach (UIElement child in panel.Children)
{
if (!child.IsVisible)
{
SetIsInViewport(child, false);
continue;
}
var transform = child.TransformToAncestor(this);
var childBounds = transform.TransformBounds(new Rect(new Point(0, 0), child.RenderSize));
SetIsInViewport(child, viewport.IntersectsWith(childBounds));
}
}
示例12: ScrollViewer_ScrollChanged
private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
ScrollViewer sv = sender as ScrollViewer;
if (sv.VerticalOffset == sv.ScrollableHeight)
{
sv.ScrollToEnd();//debug breakpoint
}
}
示例13: _scrollViewer_ScrollChanged
void _scrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (_scrollViewer == null || LoadMoreCommand == null)
return;
if (e.VerticalOffset == _scrollViewer.ScrollableHeight && e.VerticalChange != 0)
LoadMoreCommand.Execute(null);
}
示例14: ChangesetHistoryGrid_ScrollChanged
private void ChangesetHistoryGrid_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
var scrollViewer = UIHelper.FindChild<ScrollViewer>(this, "GraphScrollViewer");
scrollViewer.ScrollToVerticalOffset(Math.Floor(e.VerticalOffset) * 24);
var dataGrid = UIHelper.FindChild<DataGrid>(this, "ChangesetHistoryGrid");
scrollViewer.Height = Math.Abs(dataGrid.ActualHeight - 24);
}
示例15: OnHScrollChanged
private static void OnHScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (e.HorizontalChange != 0)
{
var changedScrollViewer = sender as ScrollViewer;
ApplyHScroll(changedScrollViewer);
}
}