I want to display the results of A, B, and C according to the formula I set using the values in each column.
I found out that there is a function to summarize the values of the Grid.Any simple examples?
The example provided by infragistic is a bit more complex. If there is a simpler example, I would like to refer to it.
I found an example while Googling. If you look at SummaryOperandThere are Min, Max, Sum, Average, Count, and Custom.How do I put the calculated value of the formula I want?
Hello,
I am under the impression that you are looking to add summaries to the XamDataGrid in a Xamarin.Forms project. If this is true, we have a full documentation article about this with code-snippets on to add the summaries, here: https://ko.infragistics.com/help/xamarin/datagrid-column-summaries. I would encourage you to take a look.
Please let me know if you have any other questions or concerns on this matter.
Using the functionality of SummaryDescriptions, I found it difficult to implement the functionality I wanted.So, I'm going to use two grids.
But if I scroll horizontally on grid1, can I make grid2 scroll with it?
One additional question is, can I use a datagrid without headers?If not, how to hide the header?
I’m not sure I can recommend using multiple grids in this case as they will be independent of each other, and there are no public events/methods that detect when the scroll has changed on the grid at this time. We do have some methods that allow you to scroll rows and columns into view, but there is no way to synchronize the scrolling at the moment between two grids.
Regarding the grid without headers, you can do this by setting the HeaderHeight property of the grid to 0.
It is worth noting that each of the ColumnSummaryDescriptions has a ProvideCalculator event that you might be able to use to get a visual like you are looking for. The event arguments of that event allows you to provide your own custom derived SummaryCalculator to do the summaries how you would like and control things like the DisplayName of the calculator. This would still require you to add a ColumnSummaryDefinition for each of your columns, as there is no “grid-wide” summary in the XamDataGrid in our Xamarin toolset, but I believe this could get you closer to the visualization that you are looking for than using multiple grids would.
Thank you for your update on this matter.
Unfortunately, there seems to be a bug in the XamDataGrid in the Infragistics for Xamarin toolset when there are multiple Custom SummaryOperands for the same column. More on that in a bit.
Regarding the centering of the DisplayName, this is unfortunately not currently possible with the XamDataGrid in the Infragistics for Xamarin, as the summaries are in a fixed-position, and it is currently assumed there will be a value and not just display text. From your screenshot, it looks like you are looking to remove the display text for some of the summary definitions as well. This can be done by providing an empty string to the DisplayText property on the ColumnSummaryDescription.
I have asked our development teams to examine the issue with the Custom summary operand. To ensure it receives attention, I have logged this in our internal tracking systems with a development ID of 274744. I will be linking this to a private support case I have created for you so that you can be notified when this is fixed or receives another resolution. This case has an ID of C-00226739 and you can access it after signing into your account on the Infragistics website, here: https://account.infragistics.com/support-cases.
public class CustomDomestic : SummaryCalculator { private float m_fData = 1.0f; public int countries; public string m_strDspName; public CustomDomestic(string DspName) { this.DispName = DspName; } public CustomDomestic() { this.DispName = this.PropertyName; } public string DispName { get { return m_strDspName; } set { m_strDspName = value; } } public override string DisplayName { get { return m_strDspName; } } public override void BeginCalculation(IDataSource dataSource, string propertyName) { base.BeginCalculation(dataSource, propertyName); this.countries = 0; } public override void Aggregate(object item) { Console.WriteLine("Aggregate: " + item); var contents = item as Employee; m_fData *= contents.KPI; //this.countries++; //if (item = "KPI") //{ // this.countries++; //} } public override ISummaryResult EndCalculation() { //eturn 1; return new DefaultSummaryResult( this.PropertyName, SummaryOperand.Custom, string.Format("{0}\n{1}",100, 200)); } }
<ig:XamDataGrid.SummaryDescriptions> <ig:ColumnSummaryDescription Operand="Custom" PropertyPath="Name" ProvideCalculator="ColumnSummaryDescription_ProvideCalculator_1" /> <ig:ColumnSummaryDescription Operand="Custom" PropertyPath="Name" ProvideCalculator="ColumnSummaryDescription_ProvideCalculator_2" />
Thank you for answer. I have too many questions to ask
FirstI put the same attribute twice, but the result is not printed. Can't I put custom twice in a row?
In the second EndCalculation output, only DisplayName is printed, but I want to center it. And I want to print only the values from the second column.
Add
I have explained a lot about my development direction and I think you will understand.
Can you make a simple example?