Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
470
Problems displaying random database selections
posted

I use XamDataGrid to display results of execution of randomly created SQL “SELECT” statements (via DataTable.DefaultView). Neither number of fields being retrieved nor their types are known at design time.

Please advise how to setup XamDataGrid to avoid these problems:
1. Dollar sign prefixes all decimal values – need to get rid of dollar sign as those values are NOT currency
2. Message “A first chance exception of type 'System.NullReferenceException' occurred in Infragistics3.Wpf.Editors.v9.1.dll” is added every time I scroll the grid. Due to this inner exception throwing the scrolling makes a tiny pause after every line. This occurs even when the solution is compiled in ‘Release’ configuration.

Here is XAML code I’m using:
<infragisticsGrid:XamDataGrid x:Name="PART_XamDataGrid" DataSource="{Binding}"    ScrollingMode="Immediate" RecordLoadMode="PreloadRecords"  RecordContainerGenerationMode="PreLoad">

 <infragisticsGrid:XamDataGrid.FieldSettings>
  <infragisticsGrid:FieldSettings
   AllowRecordFiltering="False"
   AllowEdit="False"
   CellClickAction="SelectRecord"
   EditorType="{x:Type infragisticsEditors:XamNumericEditor}"
   LabelClickAction="SortByOneFieldOnly"
   LabelTextWrapping="WrapWithOverflow"
   AllowSummaries="true"
   SummaryUIType="SingleSelectForNumericsOnly"
   SummaryDisplayArea="Top"
   LabelTextAlignment="Center">
  </infragisticsGrid:FieldSettings>
 </infragisticsGrid:XamDataGrid.FieldSettings>

 <infragisticsGrid:XamDataGrid.FieldLayoutSettings>
  <infragisticsGrid:FieldLayoutSettings
                  AutoGenerateFields="True"
   AllowFieldMoving="Default"
                  LabelLocation="SeparateHeader"
   HighlightAlternateRecords="True"
                  RecordSelectorLocation="Default"
                  AutoArrangeCells="LeftToRight"
                  SelectionTypeRecord="Single"
   DataRecordSizingMode="SizedToContentAndIndividuallySizable">
  </infragisticsGrid:FieldLayoutSettings>
 </infragisticsGrid:XamDataGrid.FieldLayoutSettings>

 <infragisticsGrid:XamDataGrid.ViewSettings>
  <infragisticsGrid:GridViewSettings Orientation="Vertical" />
 </infragisticsGrid:XamDataGrid.ViewSettings>
</infragisticsGrid:XamDataGrid>

Thank you,

Eugene

Parents
No Data
Reply
  • 69686
    Verified Answer
    posted

    Hello Eugene,

    Regarding the currency symbol, this is because  the default XamEditor for a field of type Decimal in the XamDataGrid is xamCurrencyEditor and therefore it shows the currency symbol of the current culture. One way to avoid this is to register another XamEditor to the fields of type Decimal. This is done by calling the calling the static RegisterDefaultEditorForType method of the ValueEditor Class. Please take a look at this post to see how to do this or just let me know if you have questions on this.

    Regarding the exception, first thing that comes in my mind is that it is coming from this line:

     EditorType="{x:Type infragisticsEditors:XamNumericEditor}"

    Once you have registered a new XamEditor for the Decimal value type, you will not be needing this.

    Test this and give me a feedback if the exception is gone and whether you have managed to register the new ValueEditor.

    Please note, that using PreLoad virtualization techniques can have a performance impact on the responsiveness and memory usage of the application if you have many records - in such case LazyLoad/Virtualize would be more appropriate choice.

    Regards,

    Alex.

Children