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

can't set theme in xaml with stylemanager

3 Answers 305 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
CJ chavez
Top achievements
Rank 1
CJ chavez asked on 28 May 2010, 06:30 PM
ok guys so I can't seem to be able to apply your themes to a specific control, I used the link provided from you guys to do so http://www.telerik.com/help/silverlight/common-styling-apperance-setting-theme.html#Setting_Instance-Specific_Built-In_Theme_in_XAML , unless i do it in the code behide like so:


public partial class MainPage : UserControl 
    { 
        public MainPage() 
        { 
            StyleManager.ApplicationTheme = new VistaTheme(); 
            InitializeComponent(); 
            
        } 
    } 

the problem is that i want to be able to edit the vista theme, and for that it needs to be applied in the xaml file i believe, so i can use expression blend to edit the theme styles like MouseOver and so on.

here is the code that does not work:
xaml

<UserControl x:Class="edittheme.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
    mc:Ignorable="d" 
    d:DesignHeight="300" d:DesignWidth="400"
     
     
 
    <Grid x:Name="LayoutRoot" Background="White"
 
        <telerik:RadSlider x:Name="mySlider" telerik:StyleManager.Theme="Vista" VerticalAlignment="Center"></telerik:RadSlider> 
         
    </Grid> 
</UserControl> 
 

when using code behind, i remove the telerik:StyleManager.Theme="Vista" xaml from mySlider and try the following:
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
using Telerik.Windows.Controls; 
 
namespace edittheme 
    public partial class MainPage : UserControl 
    { 
        public MainPage() 
        { 
             
            InitializeComponent(); 
            StyleManager.SetTheme(mySlider, new VistaTheme()); 
        } 
    } 
 

note: on the reference I do have the assemblies added, hence it works when I do this:
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
using Telerik.Windows.Controls; 
 
namespace edittheme 
    public partial class MainPage : UserControl 
    { 
        public MainPage() 
        { 
            StyleManager.ApplicationTheme = new VistaTheme(); 
            InitializeComponent(); 
            
        } 
    } 
 

but thats not what I want, I'm using VS2010 and expression blend 4 RC

please help, and thanks

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 31 May 2010, 03:13 PM
Hi CJ chavez,

I was not able to reproduce the problem in a simple application.

Find it attached and let me know if you manage to replicate the issue there.

P.S. I am using the official version of VS 2010.

Best wishes,
Veskoni
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
CJ chavez
Top achievements
Rank 1
answered on 31 May 2010, 03:34 PM
So after removing your assemblies and adding my own, I had to change the code like so, so it compiled:
<UserControl xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"  xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="RadControlsSilverlightApp4.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
    xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
  <Grid x:Name="LayoutRoot"
       
        <telerikGridView:RadGridView Name="gridView" controls:StyleManager.Theme="Vista" /> 
  </Grid> 
</UserControl> 
 

but it still showed the office_black theme.... :/
0
Yavor Georgiev
Telerik team
answered on 31 May 2010, 05:34 PM
Hi CJ chavez,

 Please find attached an Expression Blend project where the RadGridView in the Blend design surface loads the Vista theme, You can now use Blend to edit the Vista versions of the various telerik control templates and styles, provided you set their Theme property like I have.

All the best,
Yavor Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
CJ chavez
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
CJ chavez
Top achievements
Rank 1
Yavor Georgiev
Telerik team
Share this question
or