Hello,
I am using an ultragrid in my application. I am also allowing the end users to change column width, cell font name, font size, horizontal alignment, vertical alignment, column caption etc.
Right now, I am saving all these settings in the format of string for each column (like key-value pairs) but as the number of columns are getting increased, it is becoming quite difficult to implement more and manage.
I am looking at better ways and found that SQL Server has XML datatype and Grid has methods like SaveToXML() and LoadFromXML(). If I use this way, If I use SaveToXML() will it save all the settings (apperance settings) which I discussed above or only a part of it.
Let me know whether this works in my case or not and also I appreciate if there are any better ways.
Thanks
Nagarjun.
Yes, that is exactly what the SaveAsXml/LoadFromXml methods were designed for.
Is there any example relating to it in KB?
Can you give me an example how to read a particular column settings from the UltraGridLayout variable.
You do this the same way you read properties from the grid.
grid.DisplayLayout.Bands[x].Columns[columnKey]
layout..Bands[x].Columns[columnKey]
Yes. That's what I am using right now. But it works fine for a single column. I mean I am reading the column properties into options class properties and displaying them and if changes are made, re-assigning all the properties back to column appearance.
But when the user select two columns two or more columns, I need to read appearance of all the columns,compare one with the other and then set my class properties.
I want to know whether there is any better way that this?
Hi,
So you want to combine the properties from multiple columns into one dialog, like the Property Grid in Visual Studio?
I don't think there's any simple way to do that. You would have to examine all of the properties of the object and merge them together somehow. Or you could just use the PropertyGrid control.
I wonder if perhaps the PropertyGrid or the DotNet Framework exposes some way to do this more easily. You might want to investigate how this is achieved in the PropertyGrid and see if you can use the same method. But I don't have any knowledge in that area.
What is the best way to compare one appearance object of one column to another appearance object?
Infragistics.Win.AppearanceBase FirstColumnApp = PrintGrid.Selected.Columns[0].Appearance; for (int i = 1; i <= PrintGrid.Selected.Columns.Count - 1; i++) { if (PrintGrid.Selected.Columns[i].Appearance.Equals(FirstColumnApp))
Appearance1.Equals(Appearance20 not working.
What is the best way for it?
You mean you want a single header to span multiple columns?
There are a couple of ways you can do this, but which one you use depends on exactly what you want.
The best thing to do would be to use Groups, either in the normal layout or a GroupLayout.
Is there any way to do colspan in header? If so, can you give me an example.
nag4054 said:What is the best way to compare one appearance object of one column to another appearance object?
The Equals method will just compare instances, so that will not work. There's no easy way to compare two appearances. You will have to check every property and compare each one individually.
nag4054 said:How to fix two columns so that if you try to move one column, both the columns needs to move accordingly. Is this possible?
There is no functionality to link to columns in the grid. What you could do is handle the AfterColPosChanged event and fix up the column's positions after the user moves a column. But you will probably need to use an anti-recursion flag to prevent the event from firing continuously.
How to fix two columns so that if you try to move one column, both the columns needs to move accordingly. Is this possible?