Results 1 to 7 of 7

Thread: Silverlight 4 Toolkit Themes

  1. #1
    Join Date
    Jul 2009
    Posts
    75

    Silverlight 4 Toolkit Themes

    I would like to know how I can use the themes present in the silverlight toolkit 4 2010 in my silverlight application? I already tried this manipulation, but it gives nothing:

    - I reference the file. Dll theme
    - I added

    Code:
    xmlns: ShinyRed = "clr-namespace: System.Windows.Controls.Theming; System.Windows.Controls.Theming.ShinyRed assembly =" 
    - Then I use the tag
    Code:
    <ShinyRed:ShinyRedTheme> </ ShinyRed: ShinyRedTheme> 
    to apply the theme on the controls
    and I get the error message:

    The type ShinyRed: ShinyRedTheme is found

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: Silverlight 4 Toolkit Themes

    It was sufficient to include the namespace in the file System.Windows.Controls.Theming code behind

    Code:
      using System.Windows.Controls.Theming;
    I am sure only using this you will be able to solve the problem that you are facing. If you have any other problem then let me know about it I will try to resolve the issue as soon as possible.

  3. #3
    Join Date
    Nov 2009
    Posts
    739

    Re: Silverlight 4 Toolkit Themes

    Previously I was using SilverLight 3 and that was wonderful. In silverlight 3 I was using ImplicitStyleManager for applying the themes in the code behind. Now I am using SilverLight 4 but facing problem in applying themes. Any one has the idea how to achieve this thing in Silverlight 4. I am asking this because in SilverLight 4 ImplicitStyleManager class does not exist. I will be waiting for your reply.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Silverlight 4 Toolkit Themes

    If you want to get the control reference then the snippet of code is give below.
    void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
    ShinyRedTheme th = new ShinyRedTheme();
    BureauBlackTheme bT = new BureauBlackTheme();
    StackPanel StPa = new StackPanel();
    StPa.Children.Add(new Button() { Content="Theme Test"});
    StPa.Children.Add(new TextBlock() { Text = "Theme Test" });
    bT.Content = new Button() { Content="Black theme"};
    StPa.Children.Add(bT);
    th.Content = StPa;
    this.Content = th;
    }

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Silverlight 4 Toolkit Themes

    I know that the ImplicitStyleManager is now having a support natively in Silverlight 4. The question I want to ask is that how to apply the theme through the tool kit in the code behind that is given in the Silverlight 4, if there is an absence of ImplicitStyleManager.
    Uri sluri = new Uri( @"ThemesWithISM;component/Microsoft.Windows.Controls.Theming.ShinyBlue.xaml", UriKind.Relative );
    ImplicitStyleManager.SetResourceDictionaryUri( LayoutRoot, sluri );
    ImplicitStyleManager.SetApplyMode( LayoutRoot, ImplicitStylesApplyMode.Auto );
    ImplicitStyleManager.Apply( LayoutRoot );

  6. #6
    Join Date
    Feb 2010
    Posts
    644

    Re: Silverlight 4 Toolkit Themes

    I was also looking for the same thing but now I have got the answer for that; I have followed these thing if you are having the same problem then you can also follow the same thing.
    1. First you need to copy the Xamls to the silverlight application and for finding this you can search this thing through the search option given.
    2. After that you have to set the build action for every file to the content.
    3. After that you have to apply the snippet of code that is given below

    Code:
    ResourceDictionary ReDi = new ResourceDictionary();
    ReDi.Source = new Uri("System.Windows.Controls.Theming.ShinyBlue.xaml", UriKind.RelativeOrAbsolute);
    App.Current.Resources.MergedDictionaries.Clear();
    App.Current.Resources.MergedDictionaries.Add(ReDi);
    The only problem I am facing is that I cannot find the XAML in the manifest or the class library. It will be better if anyone can give a reply for this.

  7. #7
    Join Date
    Feb 2010
    Posts
    641

    Re: Silverlight 4 Toolkit Themes

    I am not having the idea about this thing, I think that the silverlight team is deciding to move the ImplicitStyleManage so that they can expose that thing natively; according to them this will make things a lot easier. The most annoying thing is that for accessing the theme we need to write a huge code, I think that should be given an easy way so that user can use it in a better and convenient way.

Similar Threads

  1. Silverlight 5 released; will there be a Silverlight 6?
    By GopuHD in forum Windows Software
    Replies: 4
    Last Post: 11-01-2012, 02:28 PM
  2. Replies: 5
    Last Post: 28-04-2011, 10:27 AM
  3. Replies: 3
    Last Post: 17-04-2011, 04:55 PM
  4. Facebook toolkit 3.0 and Silverlight working example
    By Abhimanyusuta in forum Windows Software
    Replies: 6
    Last Post: 09-08-2010, 09:54 PM
  5. Replies: 2
    Last Post: 09-08-2010, 09:41 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,718,524,928.15073 seconds with 17 queries