Hi Infragistics,
Currently our database is using float for currency value so when we applied into XamDataGrid, they appeared as XamNumericEditor instead of XamCurrencyEditor.
Is there any way to custom this by applying XamCurrencyEditor for all float value?
Thanks.
If you are not using currency editor in other places you can set implicit style for XamCurrencyEdit in App.xaml:
<Application.Resources> <Style TargetType="{x:Type igEditors:XamCurrencyEditor}"> <Setter Property="FontWeight" Value="SemiBold" /> <Setter Property="Format" Value="$ #,###.00" /> </Style> </Application.Resources>
Thanks it works but not sure why it didn't apply style of XamCurrencyEditor, it just use style of XamNumericEditor(i guess so).
I have to set this:
<igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igEditors:XamCurrencyEditor}"> <Setter Property="FontWeight" Value="SemiBold" /> <Setter Property="Format" Value="$ #,###.00" /> </Style> </igDP:XamDataGrid.Resources>
to make it works like a XamCurrencyEditor but currently, i got a lot of views with XamDataGrid that need to apply this style
Is there anyway to apply this Style for all XamDataGrid, i try to put this style on ResourceDictionary but i can set Setter to Resources property
<Style TargetType="{x:Type igDP:XamDataGrid}"> <Setter Property="Resources"> </Setter>
Please help me.
You can do it in settings:
<ig:FieldSettings EditorType="{x:Type igEditors:XamCurrencyEditor}" EditAsType="{x:Type sys:Decimal}"/>
I tried to use this
<igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:Field}"> <Style.Triggers> <Trigger Property="DataType" Value="{x:Type sys:Double}"> <Setter Property="Settings"> <Setter.Value> <igDP:FieldSettings EditorType="{x:Type igEditors:XamCurrencyEditor}" EditAsType="{x:Type sys:Double}" /> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style>
But it didn't work :(
Yes, you can use the static RegisterDefaultEditorForType method - e.g. ValueEditor.RegisterDefaultEditorForType(typeof(float), typeof(XamCurrencyEditor), true);