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,
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://es.infragistics.com/community/forums/t/86270.aspx
Please let me know if you need any further assistance on the matter
Hi Nikolov,
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.
Please let me know if you require any further assistance on the matter.