Hello.
I am using RowLoaded event for custom implementation - there is NO problem but problem occure if I set AlternationCount = 2. After that if you scrolling up/down the row.cells are duplicated and also Alternation style is not correct. I am prepared a simple sample where can you see the problem. If AlternationCount = 0 there is NO problem.
Thanks for your answer.
Regards
I am using RowLoaded event for custom implementation - there is NO problem but problem occure if I set AlternationCount = 2. After that if you scrolling up/down the row.cells are duplicated and also Alternation style is not correct. I am prepared a simple sample where can you see the problem. If AlternationCount = 0 there is NO problem.
Option Strict On |
Imports System.Collections |
Imports System.Collections.Generic |
Imports System.Collections.ObjectModel |
Imports System.Globalization |
Imports System.Linq |
Imports System.Net |
Imports System.ServiceModel |
Imports System.Windows |
Imports System.Windows.Data |
Imports System.Windows.Media |
Imports System.Windows.Resources |
Imports System.Xml.Linq |
Imports Telerik.Windows |
Imports Telerik.Windows.Controls |
Imports Telerik.Windows.Controls.GridView |
Partial Public Class MainPage |
Inherits UserControl |
Public Sub New() |
InitializeComponent() |
If System.ComponentModel.DesignerProperties.GetIsInDesignMode(Me) Then |
Return |
End If ' System.ComponentModel.DesignerProperties.GetIsInDesignMode(Me) |
' |
AddHandler Me.Loaded, AddressOf OnMainPageLoaded |
AddHandler Me.RadGrid.RowLoaded, AddressOf OnRadGridRowLoaded |
' |
Me.RadGrid.AutoGenerateColumns = False |
Me.SetGrid() |
Me.LoadData() |
End Sub ' New() |
Private _DataSource As ObservableCollection(Of SampleData) |
Private ReadOnly Property DataSource() As ObservableCollection(Of SampleData) |
Get |
Return Me._DataSource |
End Get |
End Property ' DataSource() |
Private Sub LoadData() |
Me._DataSource = New ObservableCollection(Of SampleData) |
For a As Integer = 0 To 29 |
Me.DataSource.Add(New SampleData(a + 1, String.Concat("Telerik.Windows.Controls.GridView (2009.3.1127.1030) - ", a + 1))) |
Next ' a As Integer = 0 To 29 |
' |
Me.RadGrid.ItemsSource = Me.DataSource |
End Sub ' LoadData() |
Private Sub OnRadGridRowLoaded( _ |
ByVal sender As Object, ByVal e As Telerik.Windows.Controls.GridView.RowLoadedEventArgs) |
Debug.WriteLine("OnRadGridRowLoaded - e.Row.Cells.Count = " & e.Row.Cells.Count) |
End Sub ' OnRadGridRowLoaded(ByVal sender As Object, ByVal e As ...GridView.RowLoadedEventArgs) |
Private Sub SetGrid() |
Me.RadGrid.AlternationCount = 2 |
' sample result : |
'OnRadGridRowLoaded(-e.Row.Cells.Count = 2) |
'OnRadGridRowLoaded(-e.Row.Cells.Count = 4) |
'OnRadGridRowLoaded(-e.Row.Cells.Count = 2) |
'OnRadGridRowLoaded(-e.Row.Cells.Count = 4) |
'OnRadGridRowLoaded(-e.Row.Cells.Count = 4) |
'OnRadGridRowLoaded(-e.Row.Cells.Count = 2) |
'etc... |
Me.RadGrid.CanUserFreezeColumns = False |
Me.RadGrid.CanUserReorderColumns = False |
Me.RadGrid.RowIndicatorVisibility = Windows.Visibility.Collapsed |
End Sub ' SetGrid() |
Private Sub OnMainPageLoaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) |
Me.SetGrid() |
End Sub ' OnMainPageLoaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) |
End Class ' MainPage |
Public Class SampleData |
Private _ID As Integer = 0 |
Private _Name As String = String.Empty |
Public Sub New(ByVal [id] As Integer, ByVal [name] As String) |
Me.ID = [id] |
Me.Name = [name] |
End Sub ' New(ByVal [id] As Integer, ByVal [name] As String) |
Public Property ID() As Integer |
Get |
Return Me._ID |
End Get |
Set(ByVal value As Integer) |
Me._ID = value |
End Set |
End Property ' ID() |
Public Property Name() As String |
Get |
Return Me._Name |
End Get |
Set(ByVal value As String) |
Me._Name = value |
End Set |
End Property ' Name() |
End Class ' SampleData |
<UserControl x:Class="SilverlightRadGridTest.MainPage" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:radgrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"> |
<Grid x:Name="LayoutRoot"> |
<Border Margin="10" Padding="4"> |
<radgrid:RadGridView x:Name="RadGrid" AutoGenerateColumns="False" ColumnsWidthMode="Fill"> |
<radgrid:RadGridView.Columns> |
<radgrid:GridViewDataColumn Header="ID" UniqueName="ID" DataMemberBinding="{Binding ID}" /> |
<radgrid:GridViewDataColumn Header="Name" UniqueName="Name" DataMemberBinding="{Binding Name}" /> |
</radgrid:RadGridView.Columns> |
</radgrid:RadGridView> |
</Border> |
</Grid> |
</UserControl> |
Thanks for your answer.
Regards