Color code for gantt view items

10 posts, 0 answers
  1. AMO
    AMO avatar
    31 posts
    Member since:
    Nov 2011

    Posted 04 Jan 2013 Link to this post

    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
  2. AMO
    AMO avatar
    31 posts
    Member since:
    Nov 2011

    Posted 04 Jan 2013 Link to this post

    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 ??
  3. DevCraft banner
  4. AMO
    AMO avatar
    31 posts
    Member since:
    Nov 2011

    Posted 06 Jan 2013 Link to this post

    Can this be done ??
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 07 Jan 2013 Link to this post

    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.

  6. AMO
    AMO avatar
    31 posts
    Member since:
    Nov 2011

    Posted 07 Jan 2013 Link to this post

    Thnks for the reply .I ran the silverlight project .But the background property was not binded .PLease refer screenshot .
  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 07 Jan 2013 Link to this post

    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.

  8. AMO
    AMO avatar
    31 posts
    Member since:
    Nov 2011

    Posted 07 Jan 2013 Link to this post

    Hi Miroslav,

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

    THnaks,
    Athira
  9. AMO
    AMO avatar
    31 posts
    Member since:
    Nov 2011

    Posted 07 Jan 2013 Link to this post

    Miroslav ,
    Also , can you please delete the attached images in the previous post ??Please help out .
  10. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 09 Jan 2013 Link to this post

    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.

  11. AMO
    AMO avatar
    31 posts
    Member since:
    Nov 2011

    Posted 09 Apr 2013 Link to this post

    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 ?? 








Back to Top
DevCraft banner