This is a migrated thread and some comments may be shown as answers.

GridViewCheckBoxColumn Applied theme problem.

7 Answers 129 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bharat Mendapara
Top achievements
Rank 1
Bharat Mendapara asked on 09 Sep 2014, 02:22 PM
Hi,

I have applied theme in App.xaml file as per following.

<Application x:Class="MainWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="telerik"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
                <ResourceDictionary Source="/Accumatch.TaxPayment;component/Themes/Styles.xaml"/>
                <ResourceDictionary Source="/Accumatch.TaxPayment;component/Resources/Resources.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>         
    </Application.Resources>
</Application>

I have got applied theme in all control in window instead of GridViewCheckBoxColumn of RadGridView.
I also got applied theme style in Header checkbox of RadGridView.

I have put GridViewCheckBoxColumn in RadGridView as per following.

 <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding Cleared}" Width="75" IsReadOnly="True" IsResizable="False"
                                                        IsFilterable="False" IsSortable="False" IsGroupable="False">
                            <telerik:GridViewCheckBoxColumn.Header>
                                <CheckBox x:Name="chkHeader" Click="CheckBox_Click" Content="Cleared" Foreground="Gray" HorizontalAlignment="Center"/>                                
                            </telerik:GridViewCheckBoxColumn.Header>                           
                        </telerik:GridViewCheckBoxColumn>

So I want to get style of GridViewCheckBoxColumn in all rows as like Header Checkbox as per attached image in RadGridView.

Any help will be much more appreciated.

Regrards,
Bharat Mendapara

7 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 10 Sep 2014, 11:15 AM
Hi Bharat,


Thank you for contacting us. 

As far as I can see, you modified the template of MS CheckBox based on your requirements. 
GridViewCheckBoxColumn uses GridViewCheckBox element in view mode and standard MS CheckBox in edit mode. 

You should manipulate GridViewCheckBox's template in the same way as the native CheckBox


Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Bharat Mendapara
Top achievements
Rank 1
answered on 11 Sep 2014, 04:45 AM
Hi Vanya,

I didn't modifiy the template of MS CheckBox. But when I added Metro style in App.xaml file as below then it takes default style of controls.

<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />

so can you help me, how to solve this problem.

Regards,
Bharat Mendapara


0
Vanya Pavlova
Telerik team
answered on 11 Sep 2014, 07:19 AM
Hello Bharat,


Thank you for getting back to us. 

Generally when you have defined several resource dictionaries the last one takes precedence.  
This means that the styles defined in the last merged resource dictionaries will override all styles with the same TargetType defined above.  

Looking at the provided snippet, it is not clear where you defined the styles for System.Windows.xaml and Telerik.Windows.Controls.GridView.xaml. 

May you post the exact order of merged resource dictionaries?  


Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Bharat Mendapara
Top achievements
Rank 1
answered on 11 Sep 2014, 10:41 AM
Hi  Vanya,

Thank you for quick reply

I have fixed priority of merged resource dictionaries as per following.

<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>                
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
                <ResourceDictionary Source="/Accumatch.TaxPayment;component/Themes/Styles.xaml"/>
                <ResourceDictionary Source="/Accumatch.TaxPayment;component/Resources/Resources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>         
    </Application.Resources>

How can I solve this problem by editing GridViewCheckBox's template?
Can you give code snippet for this?

Regards,
Bharat Mendapara
0
Vanya Pavlova
Telerik team
answered on 11 Sep 2014, 11:17 AM
Hello Bharat,


Yes, of course. I've prepared sample demo, which illustrates how to modify GridViewCheckBox element.
I've directly edited Telerik.Windows.Controls.GridView.xaml file against Windows8 theme.  
You may check the modified style with x:Key GridViewCheckBoxStyle

I would like to remind you that when you enter edit mode the standard MS CheckBox will appear.

Please take a look at this demo and let me know how it works for you. 


Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Bharat Mendapara
Top achievements
Rank 1
answered on 12 Sep 2014, 08:07 AM
Hi Vanya,

Thanks again for quick reply.

My problem is solved by adding GridViewCheckBoxTemplate in my style from demo project.

Regards,
Bharat Mendapara
0
Vanya Pavlova
Telerik team
answered on 12 Sep 2014, 10:29 AM
Hi Bharat,


Thank you for getting back to us. 

I'm glad to hear that you were able to resolve the issue by your side. 
If you encounter any other issues do not hesitate to contact us again. 


Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Bharat Mendapara
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Bharat Mendapara
Top achievements
Rank 1
Share this question
or