GridViewCheckBoxColumn Applied theme problem.

8 posts, 1 answers
  1. Bharat Mendapara
    Bharat Mendapara avatar
    18 posts
    Member since:
    Sep 2013

    Posted 09 Sep 2014 Link to this post

    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
  2. Answer
    Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 10 Sep 2014 Link to this post

    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.
     
  3. Bharat Mendapara
    Bharat Mendapara avatar
    18 posts
    Member since:
    Sep 2013

    Posted 10 Sep 2014 in reply to Vanya Pavlova Link to this post

    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


  4. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 11 Sep 2014 Link to this post

    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.
     
  5. Bharat Mendapara
    Bharat Mendapara avatar
    18 posts
    Member since:
    Sep 2013

    Posted 11 Sep 2014 in reply to Vanya Pavlova Link to this post

    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
  6. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 11 Sep 2014 Link to this post

    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.
     
  7. Bharat Mendapara
    Bharat Mendapara avatar
    18 posts
    Member since:
    Sep 2013

    Posted 12 Sep 2014 in reply to Vanya Pavlova Link to this post

    Hi Vanya,

    Thanks again for quick reply.

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

    Regards,
    Bharat Mendapara
  8. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 12 Sep 2014 Link to this post

    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.
     
Back to Top