Hi,
Good work on the filtering in your latest release! Good stufff.
Now, I used to have a custom filtering implementation on our grid, but want to switch to the latest features. One problem that I am running into it that I want to do some conditional formatting on certain fields depending on other fields' values.
Let me give you an example:
class DataObject { public double Data { get; } public bool IsValid { get; }}
If IsValid is true, I would like to display the double Data in the Grid. Otherwise, I would like to display a character "-". I used to do this by displaying a string in the grid, and doing that logic in the getter for the Data member. However, now I need to return an object of type double because I need the filtering to be on top of a double type, not a string.
Could you please give me some pointers on how I could solve this?
Thanks,- Szymon
Exactly what I was looking for. Thanks!
Hello Szymon,
By default, the XamDataGrid uses a XamCurrencyEditor for the double fields. You can assign a style to that editor using the EditorStyle property off of the Field's FieldSettings object. In that style, you can set the editor's NullText property to "-". This value will be returned whenever the value of the field is null. You can see an EditorStyle implemented here.
Just a quick update: I know I can have blank fields by creating a property DataNullable that returns a double?. In the case that I don't want to show a value, I can just return null. Otherwise, I return the value.
So I guess the question becomes: can I get the grid to display a "-" character if there is no data to display instead of a blank?