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

ResourceType group headers

3 Answers 93 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 06 Oct 2011, 10:37 AM
Hi,
is it possible to create header above scheduleview resourcetype group?

See attached picture

Robert

3 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 07 Oct 2011, 08:34 AM
Hello Robert,

What you can do is use the space illustrated in the screenshot. And this should be done by editing the control template of RadScheduleView and simply inserting a new element. I am afraid, you cannot,  however, add multiple headers with regards to width of resources.

Regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Robert
Top achievements
Rank 1
answered on 07 Oct 2011, 04:55 PM
Hello Dani,
and thank you for your quick response.

Now I can add some elements to the control template of RadScheduleView.
But it means
1) copy/paste large amount of ScheduleView.xaml resourcedictionary to my xaml's <UserControl.Resources> section and add my new elements to the Control template
OR
2) copy original ScheduleView.xaml into my project and link it to my xaml via <ResourceDictionary.MergedDictionaries> and than add new elements in it.
3) because my application can switch among several themes, i need to link appropriate ScheduleView.xaml dynamically from code-behind. I read this thread
http://www.telerik.com/community/forums/wpf/scheduleview/custom-controltemplate-with-specific-style.aspx
and use this code
this.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("~/Assets/Themes/ScheduleView.xaml", UriKind.RelativeOrAbsolute) });

, but it throws an exception at Source to ResourceDictionary() assigning.
"Error HRESULT E_FAIL has been returned from a call to a COM component."

How can I add ResourceDictionary dynamically? 
0
Dani
Telerik team
answered on 12 Oct 2011, 03:50 PM
Hi Robert,

You can add  resource dictionaries in that way as long as the ScheduleView.xaml file has a BuildAction set to Content and Copy to Output Directory set to Copy always.

However, I believe you cannot swap themes at runtime using this approach because you will need to recreate the UI in order for it to pick up the new theme, to say at the least.

If you wish to change theme at runtime, the simplest approach is described below.

Have a RadComboBox with all themes and bind the Theme property of RadScheduleView to the selected item of RadComboBox.

You should recreate your control once the theme changes because when controls are recreated or re-drawn, they pick up the newly selected theme.

Please, consider the following sample that demonstrates how to change the theme of a RadCalendar, for example:
public MainWindow() 
        
            InitializeComponent(); 
    
            this.RedrawContent(); 
        
    
        public void RedrawContent() 
        
            this.Content = new MyContentUserControl(); 
        }

<StackPanel  Orientation="Vertical"
            <telerik:RadComboBox Margin="5" x:Name="combo"
                <telerik:RadComboBox.Items
                    <telerik:Office_BlueTheme/> 
                    <telerik:Office_SilverTheme/> 
                    <telerik:SummerTheme/> 
                    <telerik:VistaTheme/> 
                    <telerik:Windows7Theme/> 
                    <telerik:TransparentTheme/>                     
                </telerik:RadComboBox.Items
            </telerik:RadComboBox>                            
           <telerik:RadCalendar VerticalAlignment="Center" HorizontalAlignment="Center" telerik:StyleManager.Theme="{Binding ElementName=combo,Path=SelectedItem}"/> 
        </StackPanel>

I hope this helps.

Greetings,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
ScheduleView
Asked by
Robert
Top achievements
Rank 1
Answers by
Dani
Telerik team
Robert
Top achievements
Rank 1
Share this question
or