We recently upgraded to 15.1 version. There were notable style difference which we have to fix ASAP.
XamDataGrid (We have CustomXamDataGrid) - Vertical & Horizontal Scrollbar became dark faded blue in color, Filter header dropdown scrollbar color got changed.3
Team, Can anyone respond to XamDataGrid style difference at the earliest?
Hello Eker,
Thank you for your post.
I have been looking into it and I am not sure that I understand completely your issue and what kind of styles you are using. Would you please provide me with more details about your styles? Are you using some theme or you are using default one? It will be great if you could share an isolated sample application that illustrate the issue, so I can investigate it further for you.
Looking forward to hearing from you.
Hello Lakharv,
I have been investigating your issue. About Horizontal and Vertical scrollbars it seems that it was an issue that was fixed in higher version and the current behavior is correct. About XamDataGrid filters drop down if you want to be able to achieve the default behavior while using theme Office2010Blue, that I can suggest is just to create style for ComboBox control without any Setters and style for XamComboEditor and set its ComboBoxStyle property to the ComboBox style, so you will override the style for XamComboEditor that derives from Ofice2010Blue theme with default style. I created short sample application based on your scenario to show you how you can implement this approach and achieve the functionality that you are looking for.
Please let me know of you need any further assistance on the matter.
Hi Nikilov,
Thanks a lot for your response. I understand that Horizontal and Vertical scrollbars styles are correct behaviour now, but we want to revert back to the original styles of it. The application is in production for years and production users are not ready to accept this style change within XamDataGrid. Can you help on reverting back to Horizontal and Vertical scrollbars styles within XamDataGrid?
Thanks,
Eker.
Thank you for your feedback.
I have been looking into your requirement. That I can suggest in order to be able to achieve the behavior that you want is to create style for ScrollViewer control in the Resources of XamDataGrid. You can use EventSetter in order to be able to handle Loaded event of ScrollViewer. In the event handler you can use our Utilities class and get the Grid that is parent of vertical and horizontal Scrollbars. You can access the Scrollbar directly by using Children property of Grid control and set its Style property to null, so you will override the style that was inherited from Office2010Blue theme. I modified the last sample application to show you how you can implement this approach.
Please let me know if you require any further assistance on the matter.
Hi Nikolov,
Thanks for the solution. This is what excatly we needed. But it is good if we have only one grid. In our application there are 30+ screens which contains XamDataGrid. We need to handle this at global level not in individual xaml.cs file. FYI..we are using CustomXamDatagrid (Inherited from XamDataGrid). I have tried having the below code in CustomXamDatagrid.cs as well, but that doesn't work as expected. We defined global resource for CustomXamDatagrid as well wherein we defined templates.
can you help us on handling the above solution at application global level? Waiting for your earliest responses.
Expecting for your support at the earliest.
Thank you for your feedback. Please let me know If you require any further assistance on the matter.
Thanks Nikolov for your responses. I will try this and get back to you.
Hi Lakharv,
I have been looking into it and what I can suggest is to try to use theme directly instead of with Theme property of XamDataGrid. You can include the Theme XAML in your application and use it directly. Just add the ResourceDictionaries from the DefaultStyles folder located here:
C:\Program Files (x86)\Infragistics\2015.1\WPF\DefaultStyles\DataPresenter
You only need to add the dictionaries that belong to the style you want to use. You will also need to include their dependencies.
In your project you can create folder named Themes and in your App.xaml , you can add the DataPresenterOffice2010Blue.xaml ResourceDictionary so it applies to all XamDataGrids in the application.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes\DataPresenterOffice2010Blue.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
So you will be able to modify the theme xaml as you like. You can find styles that are based on Office2010BlueScrollbar and re-template what you want.
You can take a look at the following forum thread, where similar functionality was discussed:
http://ko.infragistics.com/community/forums/t/86270.aspx
Please let me know if you need any further assistance on the matter
Awesome. That works great and removed the dependency with code behind file.
Below is the piece of code that we use in individual xaml file (30+ files), which works fine.
<Controls:MyXamDataGrid.Resources> <Style TargetType="{x:Type ComboBox}" x:Key="GridFilterCombo" ></Style> <Style TargetType="{x:Type ScrollViewer}"></Style> <Style TargetType="{x:Type ScrollBar}"></Style> <Style TargetType="{x:Type igEditors:XamComboEditor}" > <Setter Property="ComboBoxStyle" Value="{StaticResource GridFilterCombo}" /> </Style>
</Controls:MyXamDataGrid.Resources>
Style of our customized MyXamDataGrid which is defined globally:
<Style TargetType="{x:Type controls:MyXamDataGrid}"> <Setter Property="FontFamily" Value="{DynamicResource Font_Grid}"></Setter> <Setter Property="FontSize" Value="11" /> <Setter Property="Theme" Value="Office2010Blue" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type controls:MyXamDataGrid}"> <Grid x:Name="MyXamMainStackPanel" Visibility="{Binding ShowResults, Converter={StaticResource BoolToVisibilityConverter}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto"/> <RowDefinition /> </Grid.RowDefinitions> <Border Visibility="{Binding ShowData, Converter={StaticResource BoolToVisibilityConverter}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}" Grid.Row="2" CornerRadius="2" BorderBrush="#FF5C83FD" BorderThickness="1" Background="#D5ECFF"> <Grid x:Name="PART_ContentSiteGrid"/> </Border>
<Border Grid.Row="1" Height="40" HorizontalAlignment="Stretch" BorderThickness="1,1,1,1" BorderBrush="#FF5C83FD" CornerRadius="5" Visibility="{Binding ShowData, Converter={StaticResource NotBoolToVisibilityConverter}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}" > <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Style="{DynamicResource HeaderText}" Text="{Binding ErrorMessage, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}"></TextBlock> </Border>
<Border BorderThickness="1" CornerRadius="1" Margin="0,0,0,2" BorderBrush="#FF5C83FD" Visibility="{Binding ShowData, Converter={StaticResource BoolToVisibilityConverter}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}" Grid.Row="0" > <Grid ToolTipService.IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid},Path=ShowCriteriaRowToolTip}" ToolTip="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid},Path=CriteriaRowlToolTipText}" Background="#FFB9C9E4" Margin="1" Visibility="{Binding ShowButtonsSection, Converter={StaticResource BoolToVisibilityConverter}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}" >
<Grid.ColumnDefinitions> <ColumnDefinition ></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Visibility="{Binding Path=ShowMyHeader, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}, Converter={StaticResource NotBoolToVisibilityConverter}}" Grid.Column="0" Margin="2"> <TextBlock x:Name="totalRowsText" FontWeight="Bold" Margin="3,0,0,0" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid},Path=TotalRowsText}" ></TextBlock> <TextBlock Margin="5,0,0,0" FontWeight="Bold" x:Name="titleText" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid},Path=TitleText}"></TextBlock> </StackPanel>
<StackPanel Orientation="Horizontal" Visibility="{Binding Path=ShowMyHeader, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}, Converter={StaticResource BoolToVisibilityConverter}}" Grid.Column="0" Margin="2"> <TextBlock x:Name="MyHeaderText" FontWeight="Bold" Margin="3,0,0,0" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid},Path=MyeHeaderText}" ></TextBlock> </StackPanel>
<StackPanel Orientation="Horizontal" Width="80" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right"> <Grid Width="80" > <Grid.ColumnDefinitions> <ColumnDefinition Width="30"></ColumnDefinition> <ColumnDefinition Width="10"></ColumnDefinition> <ColumnDefinition Width="40"></ColumnDefinition> <ColumnDefinition Width="0"></ColumnDefinition> <ColumnDefinition Width="0"></ColumnDefinition> </Grid.ColumnDefinitions> <Button Style="{DynamicResource TextButton}" Command="{Binding PrintCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}" Grid.Column="0" x:Name="printButton" >Print</Button> <TextBlock Grid.Column="1" HorizontalAlignment="Center">|</TextBlock> <Button Style="{DynamicResource TextButton}" Command="{Binding ExportCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}" Grid.Column="2" x:Name="exportButton" >Export</Button> <TextBlock Grid.Column="3" Visibility="Hidden" HorizontalAlignment="Center">|</TextBlock> <Button Style="{DynamicResource TextButton}" Visibility="Hidden" Grid.Column="4" Command="{Binding ExpandCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:MyXamDataGrid}}" x:Name="expandButton" >Expand</Button> </Grid> </StackPanel> </Grid> </Border>
</Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
All we excatly need is to move the style we defined for Scrollviewer, Scrollbar and comboeditor to this global syle of XamDataGrid. This is really need of the hour. Can you help at this front?
I have been investigating your requirement. In order to be able to override the styles that derived from themes in XamDataGrid, you should define the styles for controls, that you want to re-template in the resources of XamDataGrid. What I can suggest is to create two empty styles for ScrollViewer and Scrollbar controls, so you will override the Office2010Blue styles for horizontal and vertical scrollbar. I modified the last sample application to show you how you can achieve the functionality that you are looking for. Please let me know if it does not cover your expectations and feel free to modify it, so you reproduce the described behavior and send it back to me for further investigation.