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

Unable to set GanttView theme

14 Answers 271 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan
Top achievements
Rank 1
Ryan asked on 08 Mar 2012, 12:21 AM
It would appear that theming in the ganttview is not supported?  I've tried the following that work correctly in other controls:

1.  In code behind, setting theme the application:
StyleManager.ApplicationTheme = new MetroTheme();

2. Setting the theme in the xaml:
<telerik:RadGanttView x:Name="radTP" telerik:StyleManager.Theme="Metro"  Grid.Row="0" Grid.Column="1" >
            <telerik:RadGanttView.Columns>
                <telerik:TreeColumnDefinition Header="Title" />
                <telerik:ColumnDefinition MemberBinding="{Binding Start}" Header="Start" ColumnWidth="180" />
                <telerik:ColumnDefinition MemberBinding="{Binding End}" Header="End" ColumnWidth="180" />
            </telerik:RadGanttView.Columns>
        </telerik:RadGanttView>

3.  Setting the theme on the control via the code behind:
StyleManager.SetTheme( radTP, new MetroTheme() );

Is there something different for GanttView, or is it simply not supporting themes?

14 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 08 Mar 2012, 08:51 AM
Hi,

To set a theme of RadGanttView, please add the attached file to your project.
After that all you have to do is to add it as a resource dictionary to your page as it is shown here.
<ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Generic_Metro.xaml" />
            </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>


Kind regards,
Rosi
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ryan
Top achievements
Rank 1
answered on 08 Mar 2012, 06:55 PM
Thanks for the fast reply,

After adding the resourcedictionary, I'm unable to compile, because of the following error in the Generic_Metro.xaml:

The tag 'ProgressPresenter' does not exist in XML namespace 'http://schemas.telerik.com/2008/xaml/presentation'. 
What assembly should I add to help it find it?

0
Rosi
Telerik team
answered on 09 Mar 2012, 10:56 AM
Hello,

Please try the following way for applying Metro theme. If this does not work for you,please specify the exact version of binaries that you use.

<ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="/Telerik.Windows.Controls.GanttView;component/Themes/Generic_Metro.xaml" />
                    <ResourceDictionary Source="/Telerik.Windows.Scheduling.Core;component/Themes/Generic_Metro.xaml" />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>

All the best,
Rosi
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ryan
Top achievements
Rank 1
answered on 09 Mar 2012, 08:09 PM
Hi Rosi,

Thanks for sending this again, but that wasn't really the problem.  I've added that prior, although I noticed before the reference to Scheduling.Core wasn't included in the ResourceDictionary XAML.  The problem has to do with the Generic_Metro.xaml page, which is where I'm getting the error (line 493 of the original xaml file):

<telerik:ProgressPresenter VerticalAlignment="Bottom" Height="2" Margin="0 0 0 2"
                                    HorizontalAlignment="Stretch" Progress="{Binding Progress}" Orientation="Horizontal">
                                <Rectangle Fill="{StaticResource MainBrush}" Opacity="0.7" VerticalAlignment="Stretch"
                                        HorizontalAlignment="Stretch" />
                            </telerik:ProgressPresenter>

And the error I'm getting is
The tag 'ProgressPresenter' does not exist in XML namespace 'http://schemas.telerik.com/2008/xaml/presentation'.

I'm running the Q1 2012 build, using Silverlight 5.
0
Rosi
Telerik team
answered on 14 Mar 2012, 09:39 AM
Hi,

Please find attached a project illustrating how to apply a Metro theme that works as expected at our side.

Kind regards,
Rosi
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Philip Eckenroth
Top achievements
Rank 1
answered on 20 Mar 2012, 06:18 PM
This sample project runs fine off the latest Production build, but it doesn't work with the latest internal build (2012.1).  Unfortunately, I need the latest internal build that fixes the popup issue, but it now breaks the Gantt theme.  Ideas???
0
Rosi
Telerik team
answered on 21 Mar 2012, 02:50 PM
Hello,

We are sorry for the inconvenience caused. The problem will be fixed with our SP build that will be available for download by the end of the week.

Regards,
Rosi
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Philip Eckenroth
Top achievements
Rank 1
answered on 21 Mar 2012, 06:07 PM
Sounds good.  Thank you for you quick response.  I will look forward to the next SP.
0
Philip Eckenroth
Top achievements
Rank 1
answered on 07 Apr 2012, 04:23 PM
I have been trying for several days to get this working with the latest internal build (2012.1.402.1050) and have been unsuccessful.  I have a simple project based on the project sample provided in this thread.  There are 2 DLL directories... one pointing to the Production DLLs and one to the Hotfix Dlls.  When pointing to the Production DLLs, the project runs fine.  When pointing to the Hotfix DLLs, the project errors on including the resources.  Even when commenting out the metro and scrollbar resources, the project compiles, but loads an empty page.
Hopefully I am just overlooking an obvious issue as it appears the demo is running off a later build than the production release (i.e. the popup issue with controls is now fixed from the first hotfix).
I am unable to upload the project, but here are key files:

MainPage.xaml.cs
<UserControl x:Class="SilverlightApplication8.MainPage"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             xmlns:local="clr-namespace:SilverlightApplication8"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             d:DesignHeight="300" d:DesignWidth="400">
 
    <Grid>
        <Grid.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="/Telerik.Windows.Controls.GanttView;component/Themes/Generic_Metro.xaml" />
                    <ResourceDictionary Source="ScrollBarStyle.xaml" />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Grid.Resources>
        <Grid.DataContext>
            <local:ViewModel/>
        </Grid.DataContext>
        <telerik:RadGanttView TasksSource="{Binding Tasks}" VisibleRange="{Binding VisibleRange}"/>
    </Grid>
</UserControl>

ViewModel.cs
namespace SilverlightApplication8
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using Telerik.Windows.Controls.GanttView;
    using Telerik.Windows.Controls.Scheduling;
    using Telerik.Windows.Core;
 
    public class ViewModel : PropertyChangedBase
    {
        public ViewModel()
        {
            var date = DateTime.Now;
 
            var iterationTask = new GanttTask { Start = date, End = date.AddDays(2), Title = "First Iteration" };
            var nextIterationTask = new GanttTask { Start = date.AddDays(7), End = date.AddDays(9), Title = "Second Iteration" };
            var ganttAPI = new GanttTask { Start = date, End = date.AddHours(16), Title = "Design public API" };
 
            var ganttDemos = new GanttTask { Start = date.AddHours(18), End = date.AddDays(1), Title = "Gantt Demos" };
            var ganttRendering = new GanttTask { Start = date.AddDays(1).AddHours(5), End = date.AddDays(2), Title = "Gantt Rendering" };
 
            var milestone = new GanttTask { Start = date.AddDays(2), End = date.AddDays(2).AddHours(1), Title = "Review", IsMilestone = true };
            ganttAPI.SetRelations(new List<Relation> { new Relation { Task = ganttDemos } });
            ganttDemos.SetRelations(new List<Relation> { new Relation { Task = ganttRendering } });
 
            iterationTask.SetChildren(new ObservableCollection<GanttTask> { ganttAPI, ganttDemos, ganttRendering, milestone });
            var gTasks = new ObservableCollection<GanttTask> {iterationTask, nextIterationTask};
            Tasks = gTasks;
            VisibleRange = new VisibleRange(date, date.AddDays(9));
        }
        private IEnumerable<GanttTask> tasks;
 
        public IEnumerable<GanttTask> Tasks
        {
            get
            {
                return tasks;
            }
            set
            {
                tasks = value;
                OnPropertyChanged(() => Tasks);
            }
 
        }
 
        private VisibleRange visibleRange;
        public VisibleRange VisibleRange
        {
            get
            {
                return visibleRange;
            }
            set
            {
                if (visibleRange == value) return;
                visibleRange = value;
                OnPropertyChanged(() => VisibleRange);
            }
        }
    }
}


Also attached a screenshot of the directory structure.  Please let me know if you need more information to reproduce the issue.

Thanks,
Philip
0
Todd
Top achievements
Rank 1
answered on 10 Apr 2012, 11:58 PM

I know you keep saying this works but I cannot get it to work either. I am trying to do it all via XAML but keep getting the same error.

I have this has my resource XAML

<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="/Telerik.Windows.Controls.GanttView;component/Generic_Metro.xaml" />

</ResourceDictionary.MergedDictionaries>

 
I have the file in the solution root set as a resource. I complie and get the following error.

Builds fine but at runtime throws an error of "Failed to assign to property 'System.Windows.ResourceDictionary.Source'. [Line: 13 Position: 44]"

if I do

<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="Generic_Metro.xaml" />
</ResourceDictionary.MergedDictionaries>

 


I get:
Object reference not set to an instance of an object. ... Generic_Metro.xaml 117 3 

UPDATE: Actually got it work by adding the new ScrollBarStyle.xaml you provided in your example.
0
Yana
Telerik team
answered on 11 Apr 2012, 02:52 PM
Hello Philip ,

Could you please download the uploaded this week internal build (2012.1.0410) and try with it? I've also attached a simple project based on the provided code with trial assemblies for a reference.

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Philip Eckenroth
Top achievements
Rank 1
answered on 12 Apr 2012, 05:40 AM
Yana,

  Thank you for your reply.  I was able to get it to work, but I am not sure it is the proper way.  I installed the latest patch (2012.1.0410) from the "Binaries" folder and it did not work.  I tried from the "Binaries.NoXaml" folder and it really messed up my XAML display on the project... I was unable to use the application to get far enought to test it out.

  I was able to get your sample project to work correctly (thank you very much for this).  I noticed the Telerik.Windows.Controls.GanttView.dll in your project was from the "Binaries.NoXaml" folder (384K version).  Since this is what was causing all the problems in the latest internal build under "Binaries", I took the "Binaries" build but replaced Telerik.Windows.Controls.GanttView.dll from the "Binaries.NoXaml" folder and everything seems to be working.

  Can you tell me what the difference between the "Binary" and "Binary.NoXaml" dlls?  Am I going to cause problems by mixing the dlls?

  Thank you for your time,
                    Philip
0
Yana
Telerik team
answered on 12 Apr 2012, 12:57 PM
Hi Philip,

Since Q1 SP1 we introduced a new way to style the controls using implicit styles. This is explained in details in the following help article:
http://www.telerik.com/help/silverlight/styling-apperance-implicit-styles-overview.html

So now we provide two folders with assemblies - the Binaries and Binaries.NoXaml. The second folder contains dlls with no xaml which can be used with implicit styles.

But note that at the moment RadGanttView has a different way of setting its styles as described in the previous posts.  With the official Q2 release you will be able to style it only with implicit styles.

For now, you can use the dlls from both Binaries and Binaries.NoXaml folders without a problem.

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Philip Eckenroth
Top achievements
Rank 1
answered on 12 Apr 2012, 05:51 PM
Yana,

  Thank you.  I understand the direction you are going.  Your help was most appreciated.

      ...Philip
Tags
GanttView
Asked by
Ryan
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Ryan
Top achievements
Rank 1
Philip Eckenroth
Top achievements
Rank 1
Todd
Top achievements
Rank 1
Yana
Telerik team
Share this question
or