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

Color code for gantt view items

9 Answers 192 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
AMO
Top achievements
Rank 1
AMO asked on 04 Jan 2013, 10:33 AM
Hi ,

I need some help with assiging a color to each of the items in a GanttTask list.I need to bind this to the background so that different tasks have different colors associated with it .

I am using the following XAML code :

 

 

 

<telerik:RadGanttView VisibleRange="{Binding VisibleRange}" TasksSource="{Binding Tasks}" PixelLength="0:2:0" >

 

 

 

 

<telerik:RadGanttView.Resources>

 

 

 

 

 

<Style TargetType="telerikGantt:EventContainer">

 

 

 

 

<Setter Property="Background" Value="{Binding Path=OriginalEvent.Background1}"></Setter>

 

 

 

 

</Style>

 

 

 

 

</telerik:RadGanttView.Resources>

 


</

 

 

telerik:RadGanttView>

 



I am using a custom class that inherits from GanttTask to bind the GanttView .

 

 

public class CustomTask : GanttTask

 

{

 

 

public CustomTask() :

 

 

 

base()

 

{}

 

 

public CustomTask(DateTime startDate, DateTime endDate, string title) :

 

 

 

base(startDate, endDate, title)

 

{}

 

 

private Brush background;

 

 

 

/// <Summary>Gets or sets Background and notifies for changes</Summary>

 

 

 

public Brush Background1

 

{

 

 

get { return this.background; }

 

 

 

set

 

{

 

 

if (this.background != value)

 

{

 

 

this.background = value;

 

 

 

// this.OnPropertyChanged(() => this.Background);

 

OnNotifyPropertyChanged(

 

"Background1");

 

}

}

}

 

 

protected void OnNotifyPropertyChanged(string p)

 

{

 

 

if (PropertyChanged != null)

 

{

PropertyChanged(

 

this, new PropertyChangedEventArgs(p));

 

}

}

 

 

public event PropertyChangedEventHandler PropertyChanged;

 

}



The background doesn't change though .I have looked into this forum post http://www.telerik.com/community/forums/silverlight/ganttview/style-gantt-bars.aspx
but couldn't bind the Background property. I have also tried binding the foreground,BorderBrush etc.
Please guide me with this .

Regards,
Athira

9 Answers, 1 is accepted

Sort by
0
AMO
Top achievements
Rank 1
answered on 04 Jan 2013, 11:30 AM
Any update  ??
What i want to do is :http://www.telerik.com/community/forums/wpf/ganttview/accentuate-grouped-task.aspx
But this is in WPF ...is there a way in Silverlight ??
0
AMO
Top achievements
Rank 1
answered on 07 Jan 2013, 04:16 AM
Can this be done ??
0
Miroslav Nedyalkov
Telerik team
answered on 07 Jan 2013, 11:09 AM
Hello Athira,

Please refer to the attached sample project - it contains a WPF and Silverlight projects, both containing GanttView with tasks with different colors.

All the best,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
AMO
Top achievements
Rank 1
answered on 07 Jan 2013, 11:38 AM
Thnks for the reply .I ran the silverlight project .But the background property was not binded .PLease refer screenshot .
0
Miroslav Nedyalkov
Telerik team
answered on 07 Jan 2013, 03:10 PM
Hi Athira,

We tried the project I sent you with both the 2012 Q3 and 2012 Q3 SP1 version of RadControls for Silverlight and it works fine. Could you please share with us which version for RadControls for Silverlight do you use?

Kind regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
AMO
Top achievements
Rank 1
answered on 08 Jan 2013, 04:29 AM
Hi Miroslav,

I am using the verision 2012.1.0215.1050..Is this an issue with this version ??

THnaks,
Athira
0
AMO
Top achievements
Rank 1
answered on 08 Jan 2013, 04:47 AM
Miroslav ,
Also , can you please delete the attached images in the previous post ??Please help out .
0
Miroslav Nedyalkov
Telerik team
answered on 09 Jan 2013, 08:34 AM
Hello Athira,

We deleted the images from the thread.

The problem you are experiencing is because you are working with the Beta version of the GanttView control. I would suggest you to upgrade to the most recent version of RadControls for Silverlight - 2012 Q3 SP1.

Regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
AMO
Top achievements
Rank 1
answered on 09 Apr 2013, 08:33 AM
Can you please let me know if this feature is supported in 2012 Q1 licenced version dll as currently we are working with this version..If not , from which release this feature is included ?? 








Tags
GanttView
Asked by
AMO
Top achievements
Rank 1
Answers by
AMO
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Share this question
or