Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to edit about nullable values? #257

Open
kanryu opened this issue Mar 23, 2018 · 5 comments
Open

How to edit about nullable values? #257

kanryu opened this issue Mar 23, 2018 · 5 comments

Comments

@kanryu
Copy link

kanryu commented Mar 23, 2018

Hi,

I want to make GUI for editing ObservableCollection < MyViewModel > .
So I'll use Telerik RadDataGrid and RadDatePicker, but I found problems.

DataGridNumericalColumn cannot edit values of type 'int?'.
DataGridDateColumn cannot show empty when the value is null for type 'DateTime?'.

And the area on the screen required by the RadDatePicker is too large to be placed on the screen. The default string "Select Date" and "Available date" are clearly unnecessary. Please display only the current date and the pull down symbol.

Comments?

@APopatanasov
Copy link
Collaborator

APopatanasov commented Mar 23, 2018

@kanryu With the current implementation of the NumericBox the control works with double?. Indeed it could be improved to work with int? however, currently it only works with double?. If you need to have a visualization of the values to be like int inside the editor you can use our new approach for building custom DataGrid columns. You can inherit from the DataGridNumericColumn and set a ValueFormat to be {0:N0} for example and no trailing numbers should be visualized.

About the DatePickerColumn you can use the same approach - to build custom column and set the EmptyContent to null. Check the attached sample that demonstrates how to achieve that.

I will mark this issue as feature request for improving the NumericBox to work with int?

If you are interested on working on these features please, let me know and I will give you some advises from where you can start.
RadDataGridIssue_257.zip

@kanryu
Copy link
Author

kanryu commented Mar 23, 2018

Thanks for your support.

With the current implementation of the NumericBox the control works with double?

When I experimented, when I display the value on the screen using DataGridNumericalColumn for the property 'int?', The value is displayed correctly on the screen. And I can switch to edit mode. However, when I finalize the edits, the value will return to the value before editing.

@APopatanasov
Copy link
Collaborator

@kanryu That observation is correct - when finalizing the edit the parser inside the control tries to parse it to double and if the parsing fails the previous value is restored.

Currently, this is expected behavior because as mentioned in my initial reply the control works only with double?. If you are interested on implementing the logic for working with int? please, let me know and I will give you some starts points.

@kanryu
Copy link
Author

kanryu commented Mar 26, 2018

@APopatanasov For business use 'int?' And 'decimal?' Are used much more than 'double?', So please work with these nullables as well.

Likewise, for DataGridDateColumn, please provide a means of customizing the dialog as with RadDatePicker. Perhaps it is possible if we describe the tag of XAML and describe it.

@APopatanasov
Copy link
Collaborator

@kanryu I agree that the control could be improved and because of that the issue is marked as a feature request for improving it - nullables will be taken into account when the improvements are made.

For the DataGridColumn I forget to mention that there is an easier approach for Styling the column's editor using the CellEditorStyle property - using it you can try to template the control visualized for editing as desired:

<telerikGrid:DataGridDateColumn PropertyName="NationalHoliday"> <telerikGrid:DataGridDateColumn.CellEditorStyle> <Style TargetType="input:RadDatePicker"> <Setter Property="EmptyContent" Value=""/> </Style> </telerikGrid:DataGridDateColumn.CellEditorStyle> </telerikGrid:DataGridDateColumn>

Hope the information will be helpful for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants