We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

GridControl nullable currency edit

Thread ID:

Created:

Updated:

Platform:

Replies:

107727 Mar 13,2013 10:41 AM Apr 10,2013 12:12 AM WPF 3
loading
Tags: GridControl
DE
Asked On March 13, 2013 10:41 AM

Hello, I have three questions regarding WPF GridControl and CurrencyEdit cell type:

1. How can I create a nullable currency cell? After I set CurrencyEdit cell type, all cells are displayed as 0,00 $, except if I explicitly reset all cells to null.

2. When I edit a currency cell I have found no way to set it to null. If I try to delete contents it just displays 0,00 instead of empty text.

3. When editing a cell, how can I force up / down arrow keys to leave cell and move up or down instead of increasing / decreasing cell value?

Thanks in advance.

Pannir Selvam S [Syncfusion]
Replied On April 2, 2013 01:20 PM

Hi De,

 

Thanks for choosing Syncfusion Product.

 

Query

Comments

How can I create a nullable currency cell? After I set CurrencyEdit cell type, all cells are displayed as 0,00 $, except if I explicitly reset all cells to null.

You can set the value as null by assigning the CellValue as null like in below code snippet.

 

this.grid.Model[1, 1].CellValue = null;

 

When I edit a currency cell I have found no way to set it to null. If I try to delete contents it just displays 0,00 instead of empty text.

You can achieve this requirement by handling the CommitCellInfo event of grid and set the cellvalue as null when the value is zero.

When editing a cell, how can I force up / down arrow keys to leave cell and move up or down instead of increasing / decreasing cell value?

You can achieve this by handling the CurrentCellPreviewKeyDown event of GridControl.

 

We have attached a sample based on the above requirement for your reference.

 

Please let us know if you have any other queries.

 

Regards,

Pannir.



GC_Basic Sample_f075c96d.zip

DE
Replied On April 3, 2013 12:53 PM

Thank you for your reply. However, it does not solve my problem.

First question is no big deal as it has a workaround and you have proposed the same solution as I have mentioned in my question: to explicitly set all cell values to null.

Second question is still not solved. Your suggestion is to convert 0 to null after cell has been edited. However, 0 is a valid value and null means the cell is empty, so there has to be a distinction between these two.

I think there is a bug in you source code.

In GridCellCurrencyEditCellRenderer.OnCurrencyValueChanged I have found the following code:
if (!uiElement.Value.HasValue) { uiElement.Value = 0; }

If I set breakpoint here I can see that the CurrencyTextBox.Value is first correctly set to null and then changed to zero. I don't think this is correct behavior. The code should at least check if UseNullOption flag is set or not. Do you have any suggestion how to work around this behavior as the method is private and cannot be overridden?

For the third question I have found a better method to just set
Style.CurrencyEdit.IsScrollingOnCircle = false;

Thank you.

Pannir Selvam S [Syncfusion]
Replied On April 10, 2013 12:12 AM

Hi De,

 

We have analyzed your query and Please find the below response.

 

Regarding Query#1,

If you want to display the CurrencyEdit cell as empty or null, then you need to explicitly set the Cellvalue as null and also set UseNullOption as true like in the below code snippet.

 

Code Snippet[C#]:

   this.grid.Model[1, 1].CellType = "CurrencyEdit";

   this.grid.Model[1, 1].CurrencyEdit.UseNullOption = true;

   this.grid.Model[1, 1].CellValue = null;

   this.grid.Model[1, 1].CurrencyEdit.NullValue = null;

 

 

 

Regarding Query #2,

After deleting the value of that cell, the CellValue should be zero and not be empty or null. This is the default behavior of CurrencyEdit cell type.

 

Please let us know if you have any other queries.

 

Regards,

Pannir


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;