We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Task Node color change (Resource Gantt chart)

Thread ID:

Created:

Updated:

Platform:

Replies:

108386 Apr 18,2013 03:33 AM UTC May 9,2013 10:46 AM UTC WPF 5
loading
Tags: GanttControl
chandru
Asked On April 18, 2013 03:33 AM UTC

Hi...

can we change the Task node color as group wise,

i.e, if i have Task 1, Task 2, Task 3......Task 10

i want to change the color(red)  for Task1, Task3, Task4
and Task2, Task5, Task6 as Blue color, like that can we display the resource view chart....

if it is possible means, please explain with sample...


Riyaj Ahamed I [Syncfusion]
Replied On April 18, 2013 05:31 AM UTC

Hi Chandru,

 

By applying custom style for the Task Nodes with converters we can change the appearance of the Gantt node based on the data.

 

To know more about the custom node styling please refer to the following link,

 

UG Link: http://help.syncfusion.com/ug/wpf/gantt/default.htm#!documents/customnodestyle.htm

 

The following code snippet illustrates this,

 

[XAML]

 

<Style x:Key="TaskNode" TargetType="{x:Type gchart:GanttNode}">

            <Setter Property="Template">

                <Setter.Value>

                    <ControlTemplate TargetType="{x:Type gchart:GanttNode}">

                        <Border Name="PART_Border"

                                Height="18"

                                VerticalAlignment="Center"

                                Background="{TemplateBinding Background}"

                                BorderBrush="#FFD26202"

                                BorderThickness="1"

                                ClipToBounds="True"

                                CornerRadius="7">

                            <Grid>

                                <Grid.ColumnDefinitions>

                                    <ColumnDefinition Width="Auto" />

                                    <ColumnDefinition Width="*" />

                                    <ColumnDefinition Width="Auto" />

                                </Grid.ColumnDefinitions>

 

                                <ToolTipService.ToolTip>

                                    <ToolTip Content="{TemplateBinding DataContext}" 

                                    ContentTemplate="{TemplateBinding ToolTipTemplate}" />

                                </ToolTipService.ToolTip>

 

                                <Thumb x:Name="PART_DragDropThumb"

                                       Grid.Column="0"

                                       Grid.ColumnSpan="3"

                                       Cursor="SizeAll">

                                    <Thumb.Template>

                                        <ControlTemplate>

                                            <Border Background="Transparent" />

                                        </ControlTemplate>

                                    </Thumb.Template>

                                </Thumb>

 

                                <Thumb x:Name="PART_LeftThumb"

                                       Grid.Column="0"

                                       HorizontalAlignment="Left"

                                       Cursor="ScrollW">

                                    <Thumb.Template>

                                        <ControlTemplate>

                                            <Border Width="4"

                                                    Height="20"

                                                    Background="Transparent"

                                                    BorderBrush="Transparent"

                                                    BorderThickness="0" />

                                        </ControlTemplate>

                                    </Thumb.Template>

                                </Thumb>

 

                                <Thumb x:Name="PART_RightThumb"

                                       Grid.Column="2"

                                       HorizontalAlignment="Right"

                                       Cursor="ScrollE">

                                    <Thumb.Template>

                                        <ControlTemplate>

                                            <Border Width="4"

                                                    Height="20"

                                                    Background="Transparent"

                                                    BorderBrush="Transparent"

                                                    BorderThickness="0" />

                                        </ControlTemplate>

                                    </Thumb.Template>

                                </Thumb>

                            </Grid>

                        </Border>

                    </ControlTemplate>

                </Setter.Value>

            </Setter>

            <Setter Property="Background" Value="{Binding Path=DataContext, RelativeSource={RelativeSource Self}, Converter={StaticResource converter}, ConverterParameter=Parent, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />

        </Style>

 

[C#]

 

public class ColorConverter: IValueConverter

    {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

        {

            var item = value as Item;

 

            if (item.Name=="Work 1")

                return (SolidColorBrush)new BrushConverter().ConvertFromString("#99FB1111");

 

            return (SolidColorBrush)new BrushConverter().ConvertFromString("#991342E2");

        }

 

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

        {

            throw new NotImplementedException();

        }

   }

 

Please check the sample from the following link,

 

Sample: CustomizeAppearance.zip

 

Note: In this sample we have used converter(ColorConverter.cs) to change the node color based on TaskName.

 

Regards,

Riyaj Ahamed I


chandru
Replied On April 18, 2013 06:41 AM UTC

Thanks for the sample...

it works fine, but if i change the visual style as "Blend", all the node color changed as white...

how can we solve this.....

Regards,

M.Chandru

chandru
Replied On April 18, 2013 07:32 AM UTC

Hi Riyaj Ahamed

Thanks for the sample...

it works fine, but if i change the visual style as "Blend", all the node color changed as white...

I want to use the Style as "Blend" and the node can be in different colors....

how can we solve this.....

I am waiting for your reply...

Regards,

M.Chandru

chandru
Replied On April 22, 2013 04:47 AM UTC

Hi Riyaj Ahamed

Thanks for the sample...

it works fine, but if i change the visual style as "Blend", all the node color changed as white...

I want to use the Style as "Blend" and the Task node can be in different colors....

how can we do this..... any samples...


Regards,

M.Chandru

Riyaj Ahamed I [Syncfusion]
Replied On May 9, 2013 10:46 AM UTC

Hi Chandru,

 

Thank you for your update.

 

We are able to reproduce the issue .Could you please create new incident for this issue  through Direct Trac system and we will update the status of this through incident.

 

Direct Trac Link : https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

 

Please let us know If you have any questions.

 

Regards,

Riyaj Ahamed I


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;