Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
140797 | Nov 7,2018 03:03 PM UTC | Nov 14,2018 09:56 AM UTC | WPF | 4 |
![]() |
Tags: SfDataGrid |
private void AssociatedObject_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
this.AssociatedObject.GetVisualContainer().ScrollOwner.PreviewMouseLeftButtonDown += ScrollOwner_PreviewMouseLeftButtonDown;
}
private void ScrollOwner_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
RepeatButton repeatButton = null;
object value = null;
var source = e.OriginalSource;
while (repeatButton == null && source != null)
{
var parent = source.GetType().GetProperty("InternalVisualParent", BindingFlags.Instance | BindingFlags.NonPublic);
value = parent.GetValue(source);
source = value;
repeatButton = value as RepeatButton;
}
if (repeatButton != null)
{
var name = ((RoutedCommand)repeatButton.Command).Name;
if (name == "LineUp")
{
for (int i = 1; i < 10; i++)
this.AssociatedObject.GetVisualContainer().LineUp();
}
else if (name == "LineDown")
{
for (int i = 1; i < 10; i++)
this.AssociatedObject.GetVisualContainer().LineDown();
}
}
} |
private void ScrollOwner_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
RepeatButton repeatButton = null;
object value = null;
var source = e.OriginalSource;
while (repeatButton == null && source != null)
{
var parent = source.GetType().GetProperty("InternalVisualParent", BindingFlags.Instance | BindingFlags.NonPublic);
value = parent.GetValue(source);
source = value;
repeatButton = value as RepeatButton;
}
if (repeatButton != null)
{
var name = ((RoutedCommand)repeatButton.Command).Name;
if (name == "LineUp" || name=="PageUp")
{
for (int i = 0; i < 10; i++)
this.AssociatedObject.GetVisualContainer().LineUp();
e.Handled = true;
}
else if (name == "LineDown" || name=="PageDown")
{
for (int i = 0; i < 10; i++)
this.AssociatedObject.GetVisualContainer().LineDown();
e.Handled = true;
}
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.