This is a migrated thread and some comments may be shown as answers.

[Solved] How do I scroll the grid programmatically?

4 Answers 277 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sampathkumar
Top achievements
Rank 1
Sampathkumar asked on 08 Dec 2009, 11:43 AM
Hi

    How do I scroll the grid programmatically?. 
    what was the lastevent fired when grid is ready state. mean after end of the grid data bindings.

regards
sampathkumar s
 

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 08 Dec 2009, 01:16 PM
Hi Sampathkumar,

You can do it like this:

using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Telerik.Windows.Controls.GridView;
  
namespace TicketID_263667_ConditionalFormattingWithCellTemplate
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
  
            this.playersGrid.DataLoaded += new System.EventHandler<System.EventArgs>(playersGrid_DataLoaded);
            this.playersGrid.ItemsSource = Club.GetPlayers();
        }
  
        void playersGrid_DataLoaded(object sender, System.EventArgs e)
        {
            var scrollViewer = this.playersGrid.ChildrenOfType<GridViewScrollViewer>()[0];
            scrollViewer.ScrollToHorizontalOffset(30);
            scrollViewer.ScrollToVerticalOffset(30);
        }
    }
}

I hope this helps.

Greetings,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Wolfgang Colsman
Top achievements
Rank 1
answered on 29 Jan 2010, 08:57 AM
Hi Ross,

i do not fiind ChildrenOfType in 00395RadControls_for_Silverlight4_2009_3_1322_Trial.zip

Regards

Wolfgang
0
Vlad
Telerik team
answered on 29 Jan 2010, 09:29 AM
Hi Wolfgang,

ChildrenOfType<T>() is extension method in Telerik.Windows.Controls namespace.

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Wolfgang Colsman
Top achievements
Rank 1
answered on 29 Jan 2010, 04:09 PM
Hi Vlad,

not in my version:

 

 

// Summary:

 

 

 

// Represents the base class for UI elements that use a System.Windows.Controls.ControlTemplate

 

 

 

// to define their appearance.

 

 

 

public abstract class Control : FrameworkElement

 

{

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.Background dependency property

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.Background dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty BackgroundProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.BorderBrush dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.BorderBrush dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty BorderBrushProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.BorderThickness dependency

 

 

 

// property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.BorderThickness dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty BorderThicknessProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.DefaultStyleKey dependency

 

 

 

// property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.DefaultStyleKey dependency

 

 

 

// property.

 

 

 

protected static readonly DependencyProperty DefaultStyleKeyProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.FontFamily dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.FontFamily dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty FontFamilyProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.FontStyle dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.FontStyle dependency

 

 

 

// property.f

 

 

 

public static readonly DependencyProperty FontSizeProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.FontStretch dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.FontStretch dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty FontStretchProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.FontStyle dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.FontStyle dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty FontStyleProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.FontWeight dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.FontWeight dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty FontWeightProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.Foreground dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.Foreground dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty ForegroundProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.HorizontalContentAlignment

 

 

 

// dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.HorizontalContentAlignment

 

 

 

// dependency property.

 

 

 

public static readonly DependencyProperty HorizontalContentAlignmentProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.IsEnabled dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.IsEnabled dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty IsEnabledProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.IsTabStop dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.IsTabStop dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty IsTabStopProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.Padding dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.Padding dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty PaddingProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.TabIndex dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.TabIndex dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty TabIndexProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.TabNavigation dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.TabNavigation dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty TabNavigationProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.Template dependency property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.Template dependency

 

 

 

// property.

 

 

 

public static readonly DependencyProperty TemplateProperty;

 

 

 

//

 

 

 

// Summary:

 

 

 

// Identifies the System.Windows.Controls.Control.VerticalContentAlignment dependency

 

 

 

// property.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The identifier for the System.Windows.Controls.Control.VerticalContentAlignment

 

 

 

// dependency property.

 

 

 

public static readonly DependencyProperty VerticalContentAlignmentProperty;

 

 

 

// Summary:

 

 

 

// Initializes a new instance of the System.Windows.Controls.Control class.

 

 

 

protected Control();

 

 

 

// Summary:

 

 

 

// Gets or sets a brush that provides the background of the control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The brush that provides the background of the control. The default is null.

 

 

 

public Brush Background { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets a brush that describes the border background of a control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The brush that is used to fill the control's border; the default is null.

 

 

 

public Brush BorderBrush { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the border thickness of a control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// A thickness value; the default is a thickness of 0 on all four sides.

 

 

 

public Thickness BorderThickness { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the key that references the default style for the control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The key that references the default style for the control. To work correctly

 

 

 

// as part of theme style lookup, this value is expected to be the System.Type

 

 

 

// of the control being styled.

 

 

 

protected object DefaultStyleKey { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the font used to display text in the control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The font used to display text in the control. The default is the "Portable

 

 

 

// User Interface".

 

 

 

public FontFamily FontFamily { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the size of the text in this control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The size of the text in the System.Windows.Controls.Control. The default

 

 

 

// is 11 (in pixels).

 

 

 

public double FontSize { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the degree to which a font is condensed or expanded on the screen.

 

 

 

//

 

 

 

// Returns:

 

 

 

// One of the values that specifies the degree to which a font is condensed

 

 

 

// or expanded on the screen. The default is System.Windows.FontStretches.Normal.

 

 

 

public FontStretch FontStretch { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the style in which the text is rendered.

 

 

 

//

 

 

 

// Returns:

 

 

 

// One of the values that specifies the style in which the text is rendered.

 

 

 

// The default is System.Windows.FontStyles.Normal.

 

 

 

public FontStyle FontStyle { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the thickness of the specified font.

 

 

 

//

 

 

 

// Returns:

 

 

 

// One of the values that specifies the thickness of the specified font. The

 

 

 

// default is System.Windows.FontWeights.Normal.

 

 

 

public FontWeight FontWeight { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets a brush that describes the foreground color.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The brush that paints the foreground of the control. The default value is

 

 

 

// System.Windows.Media.Colors.Black.

 

 

 

public Brush Foreground { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the horizontal alignment of the control's content.

 

 

 

//

 

 

 

// Returns:

 

 

 

// One of the System.Windows.HorizontalAlignment values. The default is System.Windows.HorizontalAlignment.Center.

 

 

 

public HorizontalAlignment HorizontalContentAlignment { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets a value indicating whether the user can interact with the control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// true if the user can interact with the control; otherwise, false.

 

 

 

public bool IsEnabled { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets a value that indicates whether a control is included in tab

 

 

 

// navigation.

 

 

 

//

 

 

 

// Returns:

 

 

 

// true if the control is included in tab navigation; otherwise, false. The

 

 

 

// default is true.

 

 

 

public bool IsTabStop { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the padding inside a control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The amount of space between the content of a System.Windows.Controls.Control

 

 

 

// and its System.Windows.FrameworkElement.Margin or System.Windows.Controls.Border.

 

 

 

// The default is a thickness of 0 on all four sides.

 

 

 

public Thickness Padding { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets a value that determines the order in which elements receive

 

 

 

// focus when the user navigates through controls by using the TAB key.

 

 

 

//

 

 

 

// Returns:

 

 

 

// A value that determines the order of logical navigation for a device. The

 

 

 

// default value is System.Int32.MaxValue.

 

 

 

public int TabIndex { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets a value that modifies how tabbing and System.Windows.Controls.Control.TabIndex

 

 

 

// work for this control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// A value of the enumeration. The default is System.Windows.Input.KeyboardNavigationMode.Local.

 

 

 

public KeyboardNavigationMode TabNavigation { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets a control template.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The template that defines the appearance of the System.Windows.Controls.Control.

 

 

 

public ControlTemplate Template { get; set; }

 

 

 

//

 

 

 

// Summary:

 

 

 

// Gets or sets the vertical alignment of the control's content.

 

 

 

//

 

 

 

// Returns:

 

 

 

// One of the System.Windows.VerticalAlignment values. The default is System.Windows.VerticalAlignment.Center.

 

 

 

public VerticalAlignment VerticalContentAlignment { get; set; }

 

 

 

// Summary:

 

 

 

// Occurs when the System.Windows.Controls.Control.IsEnabled property changes.

 

 

 

public event DependencyPropertyChangedEventHandler IsEnabledChanged;

 

 

 

// Summary:

 

 

 

// Loads the relevant control template so that its parts can be referenced.

 

 

 

//

 

 

 

// Returns:

 

 

 

// Returns whether the visual tree was rebuilt by this call. true indicates

 

 

 

// the tree was rebuilt; false indicates that the previous visual tree was retained.

 

 

 

public bool ApplyTemplate();

 

 

 

//

 

 

 

// Summary:

 

 

 

// Attempts to set the focus on the control.

 

 

 

//

 

 

 

// Returns:

 

 

 

// true if focus was set to the control, or focus was already on the control.

 

 

 

// false if the control is not focusable.

 

 

 

public bool Focus();

 

 

 

//

 

 

 

// Summary:

 

 

 

// Retrieves the named element in the instantiated System.Windows.Controls.ControlTemplate

 

 

 

// visual tree.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// childName:

 

 

 

// The name of element to find.

 

 

 

//

 

 

 

// Returns:

 

 

 

// The named element from the template, if found. Can return null if no element

 

 

 

// with name childName was found in the template.

 

 

 

protected DependencyObject GetTemplateChild(string childName);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.DragEnter event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.DragEventArgs that contains the event data.

 

 

 

protected virtual void OnDragEnter(DragEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.DragLeave event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.DragEventArgs that contains the event data.

 

 

 

protected virtual void OnDragLeave(DragEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.DragOver event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.DragEventArgs that contains the event data.

 

 

 

protected virtual void OnDragOver(DragEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.Drop event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.DragEventArgs that contains the event data.

 

 

 

protected virtual void OnDrop(DragEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.GotFocus event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnGotFocus(RoutedEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.KeyDown event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnKeyDown(KeyEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.KeyUp event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnKeyUp(KeyEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.LostFocus event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnLostFocus(RoutedEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.LostMouseCapture event occurs

 

 

 

// to provide handling for the event in a derived class without attaching a

 

 

 

// delegate.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.Input.MouseEventArgs that contains the event data.

 

 

 

protected virtual void OnLostMouseCapture(MouseEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.MouseEnter event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnMouseEnter(MouseEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.MouseLeave event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnMouseLeave(MouseEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.MouseLeftButtonDown event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnMouseLeftButtonDown(MouseButtonEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.MouseLeftButtonUp event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnMouseLeftButtonUp(MouseButtonEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.MouseMove event occurs.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// The data for the event.

 

 

 

protected virtual void OnMouseMove(MouseEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.MouseRightButtonDown event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.Input.MouseButtonEventArgs that contains the event data.

 

 

 

protected virtual void OnMouseRightButtonDown(MouseButtonEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.MouseRightButtonUp event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.Input.MouseButtonEventArgs that contains the event data.

 

 

 

protected virtual void OnMouseRightButtonUp(MouseButtonEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Called before the System.Windows.UIElement.MouseWheel event occurs to provide

 

 

 

// handling for the event in a derived class without attaching a delegate.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.Input.MouseWheelEventArgs that contains the event data.

 

 

 

protected virtual void OnMouseWheel(MouseWheelEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.TextInput event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.Input.TextCompositionEventArgs that contains the event data.

 

 

 

protected virtual void OnTextInput(TextCompositionEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.TextInputStart event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.Input.TextCompositionEventArgs that contains the event data.

 

 

 

protected virtual void OnTextInputStart(TextCompositionEventArgs e);

 

 

 

//

 

 

 

// Summary:

 

 

 

// Raises the System.Windows.UIElement.TextInputUpdate event.

 

 

 

//

 

 

 

// Parameters:

 

 

 

// e:

 

 

 

// A System.Windows.Input.TextCompositionEventArgs that contains the event data

 

 

 

protected virtual void OnTextInputUpdate(TextCompositionEventArgs e);

 

}

Greetings,

Wolfgang

Tags
GridView
Asked by
Sampathkumar
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Wolfgang Colsman
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or