UWP Telerik RadDataGrid 不允许我通过按回车键结束行编辑
UWP Telerik RadDataGrid not allowing me to end row edit by hitting enter
我在结束对 Telerik 的 UWP RadDataGrid 中一行的编辑时遇到问题。填充数据后,我单击一个单元格开始编辑。完成编辑行后,我按 Enter 键完成编辑,但它仍处于编辑模式。单击另一行中的单元格结束编辑,新数据完好无损,但绑定的集合不会更新。下面是我正在使用的网格的屏幕截图:
这是我页面中的 XAML 代码:
<tg:RadDataGrid ColumnDataOperationsMode="Flyout" x:Name="grid" ItemsSource="{x:Bind ViewModel.Source}" UserEditMode="Inline" Grid.ColumnSpan="4" Grid.Row="1"/>
非常感谢您的帮助。非常感谢!
After I finish editing the row I hit enter to finish editing but it remains in edit mode.
我创建了一个 16299 UWP 项目来测试并为其安装了 Telerik.UI.for.UniversalWindowsPlatform(1.0.0.7) 包。然后,我可以重现这个问题。但是,如果我将项目的目标版本更改为“15063”,当我按下 Enter
键时,它将成功提交编辑操作。所以,这个 Telerik 控件在 16299 运行 时可能会出现一些问题。您可以将此问题报告给他们的 Telerik 官方网站。
并且由于UWP的Telerik控件是开源的,您也可以查看其源代码并自行修复此问题,然后您可以自行编译自定义版本并在您的项目中使用。
我在这行代码中看到了关于这个问题的相关代码:https://github.com/telerik/UI-For-UWP/blob/master/Controls/Grid/Grid.UWP/View/RadDataGrid.Manipulation.cs#L392也许,你可以检查一下。
Clicking a cell in another row ends the edit and the new data is intact but the bound collection does not get updated.
我没有看到你的代码,所以我不知道问题出在哪里。但它对我来说效果很好。您可以查看我的简单代码示例以供参考:
<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));
}
}
}
我在结束对 Telerik 的 UWP RadDataGrid 中一行的编辑时遇到问题。填充数据后,我单击一个单元格开始编辑。完成编辑行后,我按 Enter 键完成编辑,但它仍处于编辑模式。单击另一行中的单元格结束编辑,新数据完好无损,但绑定的集合不会更新。下面是我正在使用的网格的屏幕截图: 这是我页面中的 XAML 代码:
<tg:RadDataGrid ColumnDataOperationsMode="Flyout" x:Name="grid" ItemsSource="{x:Bind ViewModel.Source}" UserEditMode="Inline" Grid.ColumnSpan="4" Grid.Row="1"/>
非常感谢您的帮助。非常感谢!
After I finish editing the row I hit enter to finish editing but it remains in edit mode.
我创建了一个 16299 UWP 项目来测试并为其安装了 Telerik.UI.for.UniversalWindowsPlatform(1.0.0.7) 包。然后,我可以重现这个问题。但是,如果我将项目的目标版本更改为“15063”,当我按下 Enter
键时,它将成功提交编辑操作。所以,这个 Telerik 控件在 16299 运行 时可能会出现一些问题。您可以将此问题报告给他们的 Telerik 官方网站。
并且由于UWP的Telerik控件是开源的,您也可以查看其源代码并自行修复此问题,然后您可以自行编译自定义版本并在您的项目中使用。
我在这行代码中看到了关于这个问题的相关代码:https://github.com/telerik/UI-For-UWP/blob/master/Controls/Grid/Grid.UWP/View/RadDataGrid.Manipulation.cs#L392也许,你可以检查一下。
Clicking a cell in another row ends the edit and the new data is intact but the bound collection does not get updated.
我没有看到你的代码,所以我不知道问题出在哪里。但它对我来说效果很好。您可以查看我的简单代码示例以供参考:
<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));
}
}
}