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.
As an additional point of discussion: our application can be customized, by loading *.isl skins, that basically match the ones that are distributed with Infragistics:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/AppStyling_Sample_Style_Libraries.html
Do you provide any support to convert these sample styles, from Windows Forms to WPF? Or I'm supposed to replicate the restyling work on xamDataGrid, one for each skin supported by our application?
Where can I find the WPF version for the styles you distribute for Windows Forms (ie: Office2007Blue.isl, Office2010Silver.isl, VS2010.isl, ...)?
Thanks again.
Hi,
I understand your point. In general both platforms are totally different and to set a simple back color to a cell for example is completely different in WPF and Win Forms. Even the functionality and background data presentation is different so we can’t use similar approach like AppStylist in WPF.
The best approach to style WPF is to use styles. It will be very hard to make WPF grid to look identical like Windows forms grid. One option is to host directly WinGrid in to WPF so you will have the consistent look, but I guess that this is not what you are looking for since you are looking for functionality of the WPF.
massimogentilin said: 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.
Yes, this is the correct approach.
massimogentilin said: Do you provide any support to convert these sample styles, from Windows Forms to WPF? Or I'm supposed to replicate the restyling work on xamDataGrid, one for each skin supported by our application? Where can I find the WPF version for the styles you distribute for Windows Forms (ie: Office2007Blue.isl, Office2010Silver.isl, VS2010.isl, ...)?
No, there is no such tool or even corresponding styles or method doing that, creating manually the styles you need is the only one way to achieve the same look. The specific isl files you mentioned are related to windows forms and because of the difference between these two platforms we don’t have exactly the same for XamDataGrid but you could look for something close to your styling in to the Themes we have for XamDataGrid:
http://help.infragistics.com/NetAdvantage/WPF/2012.1/CLR4.0/?page=xamData_Using_Built_In_Themes.html
I hope this answer your questions.
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 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.
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
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.
The approach is the same for both grid. I was asking because the two different grid recurred different references. So I will focus on XamDataGrid and try to prepare for you a sample using a Office2010Blue them.
I will upload the sample when I finish it.
I'm currently using xamDataGrid. But my original question is valid also for xamGrid: in the future, we may use the other grid, and we may still need to style it...
Do you think we should adjust question's title, by replacing xamGrid with xamDataGrid?