2 General question

2 posts, 0 answers
  1. Reinhard
    Reinhard avatar
    9 posts
    Member since:
    Jun 2010

    Posted 20 Sep 2011 Link to this post

    Hello all.

    I know, it´s sure a silly question, but i can´t  find a solution.

    1.)
    I have an external class to manage the styles for all controls.
    This interface has the "INotifyPropertyChanged" implemented.

    In the ComboBox, I now choose a different Theme, but my controls do not change their appearance.

     
    xmlns: Controls3 = "clr-namespace: Telerik.Windows.Controls; assembly = Telerik.Windows.Controls"

    In the resources of xaml I have:
     
    <myThemen:MyTheme x:Key="tehmen" />

    In the Controls:
    Controls3:StyleManager.Theme="{Binding Source={StaticResource tehmen}, Path=MyThema, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

     
    2.)
    I set the Itemssource of my RadGridView in the code.
    "datagrid.ItemsSource = KonaktList1;"

    How can i set it into XAML?
    see code: in MainWindow.xaml.cs

    At the appendix is attached to a dummy project, so you see what I mean.


     many greetings

    Reinhard
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 22 Sep 2011 Link to this post

    Hello Reinhard,

    Changing the theme at run time is not very straightforward. I can suggest you the following approach:
    - add the Themes themselves as items for the ComboBox like so:

    <telerik:RadComboBox x:Name="themesComboBox" SelectionChanged="RadComboBox_SelectionChanged" SelectedIndex="0">
                            <telerik:Expression_DarkTheme />
                            <telerik:MetroTheme />
                            <telerik:Windows7Theme />
    </telerik:RadComboBox>

    - after that in the SelectionChanged event of the ComboBox refresh the page:

    private void combobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                StyleManager.ApplicationTheme = e.AddedItems[0] as Theme;
      
                if (this.Content != null && this is Page)
                {
                    this.NavigationService.Refresh();
                }
      
            }

    As for the GridView question - you can find more info here.
    Attached I am sending you your project with the above-mentioned changes made.

    Hope this helps.

    Greetings,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top