Hi,
i would like to change the color of a specific task with a button click, is it possible?
In order to obtain this result below.
Best regards
Gian Piero Truccolo
Hi,
does exist a workaround to reach this goal?
For example rigenerate l'itemsource?or something else?
Best regards
Gian Piero Truccolo
|
public class Task : NotificationObject
{
Brush nodeColor = (SolidColorBrush)new BrushConverter().ConvertFrom("#FF6BE6ED"
....
public Brush NodeColor {
get
{
return nodeColor;
}
set
{
nodeColor = value;
RaisePropertyChanged("NodeColor");
}
} .... |
|
<Style TargetType="chart:GanttNode"
x:Key="TaskNode">
<Setter Property="HorizontalAlignment"
Value="Left" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="chart:GanttNode">
... <Border Name="PART_Border" Height="11"
Width="{TemplateBinding Width}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
SnapsToDevicePixels="True"
BorderThickness="0,0.4,0,0.4"
BorderBrush="Black"
Background="{Binding NodeColor}"> ....... |
|
private void TestButton_Click(object sender, RoutedEventArgs e)
{
(this.Gantt.ItemsSource as ObservableCollection<Task>)[0].ChildTask[0].NodeColor = (Brush)new BrushConverter().ConvertFromString(nodeColors[r.Next(0, 9)]);
} |