
I am not able to get the rows having all the columns. Only the columns which are visible using scrollbar are coming as cells of that row.
I have used below given code.
var rows = gridView.ChildrenOfType<GridViewRow>();
foreach (var row in rows)
{
foreach (var cell in row.Cells)
{
foreach (var selectedItem in gridView.SelectedItems)
{
var row = (gridView.ItemContainerGenerator.ContainerFromIndex(1) as GridViewRow);
foreach (var cell in row.Cells)
Please suggest me how to get full row having all the columns from selected items.
I have enabled column & row virtulization.
I have a custom GridView inherited from ‘RadGridView’ which is binded to generic list.
Some of the rows in the gridview is becoming readonly(Edited values are getting restored to older value when curser moved to next position) while editing(not all rows).
Please help
Custom grid view
------------
public enum EquipmentList
{
Unknown,
StowList,
DischargeList,
RestowList,
HandList,
StowedList,
ProcessList
}
public class EquipmentsGridView : RadGridView
{
public EquipmentList ListType { get; set; }
private ObservableCollection<EquipmentInformation> _source;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "By design")]
public IList<EquipmentInformation> Source
{
get
{
return _source;
}
set
{
if (_source != null)
{
_source.CollectionChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(_source_CollectionChanged);
}
base.ItemsSource = _source = new ObservableCollection<EquipmentInformation>(value);
_source.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(_source_CollectionChanged);
ResetNumbers();
ApplyBehavior();
}
}
public bool IsEdited { get; set; }
public EquipmentsGridView()
{
base.CellValidating += GridView_CellValidating;
base.SelectionChanged += new EventHandler<SelectionChangeEventArgs>(EquipmentsGridView_SelectionChanged);
}
void EquipmentsGridView_SelectionChanged(object sender, SelectionChangeEventArgs e)
{
if (this.Items.IsAddingNew || this.Items.IsEditingItem)
{
this.CommitEdit();
}
}
private void ApplyBehavior()
{
foreach (var column in base.Columns)
{
if (column is GridViewBoundColumnBase)
{
column.ShowDistinctFilters = false;
}
}
}
void EquipmentsGridView_CellValidated(object sender, GridViewCellValidatedEventArgs e)
{
if (e.Cell.ParentRow.Item != null)
{
if (((EquipmentInformation)e.Cell.ParentRow.Item).IsCanceled)
{
e.Cell.Foreground = Brushes.White;
e.Cell.Background = Brushes.Red;
e.Cell.FontStyle = FontStyles.Oblique;
}
else
{
e.Cell.Foreground = Brushes.Black;
e.Cell.Background = Brushes.White;
e.Cell.FontStyle = FontStyles.Normal;
}
}
}
void _source_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove ||
e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
{
ResetNumbers();
IsEdited = true;
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Editing need to be in lowercase")]
private void GridView_CellValidating(object sender, Telerik.Windows.Controls.GridViewCellValidatingEventArgs e)
{
if (e.OldValue != e.NewValue)
{
((System.Windows.Controls.TextBox)(e.EditingElement)).Text = e.NewValue.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture);
IsEdited = true;
}
}
}

public static void TextChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { double dub; if (e.OldValue != null && e.NewValue != null && (e.NewValue is double || (e.NewValue is string && double.TryParse(e.NewValue.ToString(), out dub)))) { var control = o as ValueCellPresenter; if (control.IsLoaded) { ((Storyboard)control.Resources["CellFlash"]).Begin(); } } }