Hi all!
We developed a mixed application, that uses both Windows Forms and WPF Infragistics components. In order to keep a consistent style for the whole application, we need to apply xamGrid the same style we defined for Windows Forms UltraGrid (you can see an example here).
What do you think is the best approach to achieve this result? I think assigning a style to the grid using pure XAML is a very difficult task...
Thank you, bye. Maria
Hello Maria,
I am just checking if the latest reply helped you out or if you require any further assistance on the matter.
Hi Gineva,sorry I was out of office during last weeks.
Thank you for the links you provided. Our goal is to have the same, *identical*, style for the two grids. So the theme solution cannot be applied.
If you know how complex is xamDataGrid, how many nested controls it is made of, then you can understand why I'm saying that also the style solution is not suitable. Am I missing something?
What you're suggesting to do is:
- create a copy of the default style, which is located in "C:\Program Files\Infragistics\NetAdvantage 2011.2\WPF\DefaultStyles\XamGrid" (is it the right folder?);
- manually customize the template, trying to give each nested component the required look.
This is the procedure I followed to style xamDataTree, about an year ago. But, that time, I had to apply only few changes to the tree. Now I have to "totally restyle" the grid...
Thank you, bye.
Ok. I tried the solution you suggested, just to verify how complex is the restyling work. I created a new solution, putting a XamDataGrid on MainWindow: window opens, and sample data are loaded in the grid.
Then I tried two different approaches.
1) I copied this file: "C:\Program Files (x86)\Infragistics\NetAdvantage 2011.2\WPF\DefaultStyles\XamGrid\generic.xaml" and added it as a resource to my project. Then, i referenced it from the window as MergedDictionary.
ERRORS:
Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'Infragistics.Controls.Grids' that is not included in the assembly. C:\Lab\Test\csharp\TestXamGrid\TestXamGrid\Styles\generic.xaml 6 14 TestXamGrid
Undefined CLR namespace. The 'clr-namespace' URI refers to a namespace 'Infragistics.Controls.Grids.Primitives' that is not included in the assembly. C:\Lab\Test\csharp\TestXamGrid\TestXamGrid\Styles\generic.xaml 7 18 TestXamGrid
The type 'igPrim:CultureValueConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Lab\Test\csharp\TestXamGrid\TestXamGrid\Styles\generic.xaml 295 6 TestXamGrid
and so on...
These are the references I included in my project:
InfragisticsWPF4.Controls.Editors.XamColorPicker.v11.2InfragisticsWPF4.Controls.Editors.XamComboEditor.v11.2InfragisticsWPF4.Controls.Editors.XamMaskedInput.v11.2InfragisticsWPF4.Controls.Grids.DateTimeColumn.v11.2InfragisticsWPF4.Controls.Grids.MultiColumnComboColumn.v11.2InfragisticsWPF4.Controls.Grids.XamGrid.v11.2InfragisticsWPF4.Controls.Menus.XamDataTree.v11.2InfragisticsWPF4.Controls.Menus.XamMenu.v11.2InfragisticsWPF4.DataManager.v11.2InfragisticsWPF4.DataPresenter.v11.2InfragisticsWPF4.Editors.v11.2InfragisticsWPF4.v11.2
2) I excluded 'generic.xaml' from my project and added a copy of these files:
- "C:\Program Files (x86)\Infragistics\NetAdvantage 2011.2\WPF\Themes\igTheme\IG.xamGrid.xaml";- "C:\Program Files (x86)\Infragistics\NetAdvantage 2011.2\WPF\Themes\Office2010Blue\Office2010Blue.xamGrid.xaml".
I referenced the first as MergedDictionary and started the application: cannot see differences in grid's appearance: grid is gray, group-by-area is blue and the selected row is light blue.
I closed the application, referenced the second theme and, again, cannot see any changes.
This is an extract with grid's definition:
<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}"> <igDP:XamDataGrid d:LayoutOverrides="Width" DataSource="{Binding Collection}" IsGroupByAreaExpanded="True" GroupByAreaMode="MultipleFieldLayoutsFull" > <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AllowAddNew="False"/> </igDP:XamDataGrid.FieldLayoutSettings> </igDP:XamDataGrid></Grid>
Note that the 'Theme' property is not set. But, I think, it takes its default value, which is responsible for displaying the grid with the blue area and selection. Then, why the style I referenced is not loaded?
Could you please help me, trying to make it work?Another little question: the name of Infragistics' styles is always 'xamGrid'. Do they apply also to xamDataGrid?Thank you, bye.
Hi,
Ok, I see you are trying to add different references and before go furthered can you specify which grid you have in your project- XamDataGrid or XamGrid? See more for the differences here:
http://es.infragistics.com/community/blogs/engineering/archive/2011/11/11/xamgrid-vs-xamdatagrid-conceptual-and-feature-comparison.aspx
I am looking forward to hearing from you.
As we discussed in order to overwrite XamDataGrid style you have to tahe the default sytyle and modify it, in your case you want to base your styling on some specific them so you can use the theme styles and modify it in the way you want.
The attached sample includes all the necessary resource dictionaries needed in order to use the Office2010Blue theme as a project included theme. Adding the theme as a merged dictionary in the application's resources will allow the theme to automatically apply itself to the XamDataGrid without needing to set the Theme property.
I hope this helps.
Hi Gineva,thank you for taking the time to prepare this sample app.
Unfortunately it does not include all the required resources, so it doesn't compile. Anyway, I figured out what was going wrong in my previous tests.
To answer my questions:1) how to avoid errors on "generic.xaml": simply don't use it;2) why, in my sample project, Office2010Blue style was not applied: of course, I was referencing the wrong files!!
Styles for xamDataGrid's nested controls are contained in this folder: C:\Program Files (x86)\Infragistics\NetAdvantage 2011.2\WPF\DefaultStyles\DataPresenterand not in the folder that I mentioned in my previous posts.
In the meanwhile, I've found a method to customize the style of the grid, that doesn't need to start from the default styles. Styling exactly what I need, using Snoop or making some search on the web to find the correct "styling point" for that particular background color or other style that I need.
So I think we can close this thread. Thank you and have a nice we.Maria
Hi Maria,
I am glad that you find the answer and post it to our community.
Regarding your questions and answers, that’s way I have asked which grid we are going to re-template to start from scratch and avoid any confusions.
Again , I am glad to that you find a way that suits to your requirements.