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

2 General question

1 Answer 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Reinhard
Top achievements
Rank 2
Reinhard asked on 20 Sep 2011, 08:56 AM
Hello all.

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

Geben Sie Text oder eine Website-Adresse ein oder lassen Sie ein Dokument übersetzen.

Übersetzung von Deutsch nach Englisch


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

1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 22 Sep 2011, 01:18 PM
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 >>
Tags
General Discussions
Asked by
Reinhard
Top achievements
Rank 2
Answers by
Konstantina
Telerik team
Share this question
or