ScreenToGif/Util/ScrollSynchronizer.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace ScreenToGif.Util
{
public class ScrollSynchronizer : DependencyObject
{
/// <summary>
/// Identifies the attached property ScrollGroup
/// </summary>
public static readonly DependencyProperty ScrollGroupProperty =
DependencyProperty.RegisterAttached("ScrollGroup", typeof(string), typeof(ScrollSynchronizer), new PropertyMetadata(OnScrollGroupChanged));
/// <summary>
/// List of all registered scroll viewers.
/// </summary>
private static readonly Dictionary<ScrollViewer, string> ScrollViewers = new Dictionary<ScrollViewer, string>();
/// <summary>
/// Contains the latest horizontal scroll offset for each scroll group.
/// </summary>
private static readonly Dictionary<string, double> HorizontalScrollOffsets = new Dictionary<string, double>();
/// <summary>
/// Contains the latest vertical scroll offset for each scroll group.
/// </summary>
private static readonly Dictionary<string, double> VerticalScrollOffsets = new Dictionary<string, double>();
/// <summary>
/// Sets the value of the attached property ScrollGroup.
/// </summary>
/// <param name="obj">Object on which the property should be applied.</param>
/// <param name="scrollGroup">Value of the property.</param>
public static void SetScrollGroup(DependencyObject obj, string scrollGroup)
{
obj.SetValue(ScrollGroupProperty, scrollGroup);
}
/// <summary>
/// Gets the value of the attached property ScrollGroup.
/// </summary>
/// <param name="obj">Object for which the property should be read.</param>
/// <returns>Value of the property StartTime</returns>
public static string GetScrollGroup(DependencyObject obj)
{
return (string)obj.GetValue(ScrollGroupProperty);
}
/// <summary>
/// Occurs, when the ScrollGroupProperty has changed.
/// </summary>
/// <param name="d">The DependencyObject on which the property has changed value.</param>
/// <param name="e">Event data that is issued by any event that tracks changes to the effective value of this property.</param>
private static void OnScrollGroupChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var scrollViewer = d as ScrollViewer;
if (scrollViewer != null)
后面还有 78 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
