Search code examples
xamluwptelerikgriduwp-xaml

UWP Telerik RadDataGrid not allowing me to end row edit by hitting enter


I am having trouble ending an edit of a row in Telerik's UWP RadDataGrid. Once the data is populated I click on a cell to start an edit. After I finish editing the row I hit enter to finish editing but it remains in edit mode. Clicking a cell in another row ends the edit and the new data is intact but the bound collection does not get updated. Below is a screen shot of the grid I am using: Here is the XAML code in my page:

<tg:RadDataGrid ColumnDataOperationsMode="Flyout"  x:Name="grid" ItemsSource="{x:Bind ViewModel.Source}" UserEditMode="Inline"  Grid.ColumnSpan="4" Grid.Row="1"/>

enter image description here

I would really appreciate some help. Thanks so much in advance!


Solution

  • After I finish editing the row I hit enter to finish editing but it remains in edit mode.

    I created a 16299 UWP project to test and installed the Telerik.UI.for.UniversalWindowsPlatform(1.0.0.7) package for it. Then, I can reproduce this issue. But if I change my project's target version to "15063", when I hit Enter key, it will commit an edit operation successfully. So, this telerik control might has some issues when it's running in 16299. You could report this issue to their official site of Telerik.

    And since the Telerik controls of UWP is open source, you could also check its source code and fix this issue by yourself, then you could compile your custom version by yourself and use it in your project.

    I saw the relevant code about this issue maybe in this line code: https://github.com/telerik/UI-For-UWP/blob/master/Controls/Grid/Grid.UWP/View/RadDataGrid.Manipulation.cs#L392 Maybe, you could check it.

    Clicking a cell in another row ends the edit and the new data is intact but the bound collection does not get updated.

    I have not saw your code, so I didn't know where the issue is. But it worked well on my side. You could check my simple code sample for reference:

    <telerikGrid:RadDataGrid x:Name="DataGrid" ItemsSource="{x:Bind ls}" UserEditMode="Inline"></telerikGrid:RadDataGrid>
    
    public sealed partial class MainPage : Page
    {
        public ObservableCollection<Data> ls { get; set; }
        public MainPage()
        {
            this.InitializeComponent();
            ls = new ObservableCollection<Data>() {new Data { Country = "India", Capital = "New Delhi"},
     new Data { Country = "South Africa", Capital = "Cape Town"},
     new Data { Country = "Nigeria", Capital = "Abuja" },
     new Data { Country = "Singapore", Capital = "Singapore" }  };
        }
    }
    
    public class Data:INotifyPropertyChanged
    {
        private string _Country;
        public string Country
        {
            get { return _Country; }
            set
            {
                _Country = value;
                RaisePropertyChange("Country");
            }
        }
    
        private string _Capital;
        public string Capital
        {
            get { return _Capital; }
            set
            {
                _Capital = value;
                RaisePropertyChange("Capital");
            }
        }
    
        public event PropertyChangedEventHandler PropertyChanged;
    
        public void RaisePropertyChange(string propertyName)
        {
            if (PropertyChanged!= null)
            {
                PropertyChanged(this,new PropertyChangedEventArgs(propertyName));
            }
        }
    }