RadiantQ Forum
Product => WPF Gantt Package => Topic started by: michael.fried on October 14, 2014, 08:11:16 AM
-
Hi,
Is there a possibility to add labeling to each seperate part of a FGWorkingHoursBar?
At the moment I just draw a text box with a higher Z-index over the full bar which enables me to label the bar in the left, middle or right corner. The desired behaviour is outlined below:
(http://i.imgur.com/Z3Q8wvb.png)
http://imgur.com/Z3Q8wvb (http://imgur.com/Z3Q8wvb)
Kind regards,
Michael
-
Michael,
Can you tell us where the data for this label comes from?
Regards,
-Raja.
-
Hi Raja,
The data will come from a dynamic data binding in the xaml file. At the moment im drawing a border over the whole bar and show the label only in the middle of the bar in textblock.
<view:FGWorkingHoursBar HorizontalAlignment="Stretch"
TaskBrush="{StaticResource WorkingBarFill}"
TaskStrokeBrush="Blue"
NonWorkingTimeTaskBrush="{StaticResource NonWorkingBarFill}"
NonWorkingTimeTaskStrokeBrush="Black"
NonWorkingBarHeightProportion="10"
TasksDontStartAndEndInNonWorkingTime="False"
SchedulePropertyName="Schedule">
</view:FGWorkingHoursBar>
<Border
Canvas.ZIndex="2"
Background="{Binding Styling.Background}"
CornerRadius="{Binding Styling.BorderCornerRadius}"
BorderBrush="{Binding Styling.BorderBrush}"
BorderThickness="{Binding Styling.BorderThickness}"
Effect="{Binding Styling.BorderEffect}"
Opacity="0.9">
<TextBlock Margin="1"
Foreground="{Binding Styling.Foreground}"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
TextAlignment="Center"
Text="{Binding Text}" />
</Border>
The mockup in the post above only shows the desired behaviour.
Regards,
Michael
-
Ok, we are working on this, we will update you soon.
Thanks
RadiantQ Support
-
Michael,
We are planning on providing you a way to specify a "DataTemplate" in XAML which we will render within each "working hour bar". What would you need in the data context of this template that you will define?
- You will probably need the underlying "task" data object.
- Do you also need the start and end time of this "working hour bar"?
- Anything else?
Thanks
RadiantQ Support
-
Hi,
Sorry for the late answer.
- You will probably need the underlying "task" data object.
yes
- Do you also need the start and end time of this "working hour bar"?
not necessarily but it wouldn't harm
- Anything else?
Tooltips but I do not necessarily need them for each working bar seperately.
Thanks a lot,
Michael
-
Michael,
We are looking on this, we will update you soon.
Regards,
-Raja.
-
Michael,
We have now added support for adding some custom UI elements on top of the "working hours bar". We will send you an assembly by email shortly.
With that new assembly, you can create a custom class like below and use it in XAML to get a label (TextBlock) rendered on top of the working hours bar.
public class MyFGWorkingHoursBar : FGWorkingHoursBar
{
protected override void OnAfterWorkingHoursBarCreated(Rectangle rectangle)
{
Task task = this.DataContext as Task;
// Create a TextBlock with the same dim as rectangle.
TextBlock tb = new TextBlock() { Margin = rectangle.Margin, Width = rectangle.Width, Height = rectangle.Height, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, TextAlignment = TextAlignment.Center, VerticalAlignment = System.Windows.VerticalAlignment.Center };
Canvas.SetZIndex(tb, 10); // To ensure that this render over the Rectangle.
tb.Text = task.TaskName;
this.Children.Add(tb);
}
}
You can then use the above in your XAML:
<fxgantt:FlexyGantt.TaskItemTemplate>
<DataTemplate>
<Grid Height="18" AllowDrop="True"
ToolTipService.ToolTip="{Binding StartTime}">
<local:MyFGWorkingHoursBar HorizontalAlignment="Stretch" TaskBrush="{StaticResource WorkingBarFill}" TaskStrokeBrush="Blue"
NonWorkingTimeTaskBrush="{StaticResource NonWorkingBarFill}" NonWorkingTimeTaskStrokeBrush="Black" NonWorkingBarHeightProportion="25"
SchedulePropertyName="Schedule" >
</local:MyFGWorkingHoursBar>
...........
</Grid>
</DataTemplate>
Thanks
RadiantQ Support
-
Awesome, your solution works like a charm.
Many thanks for the quick fix.
Best,
Michael
-
Hello again,
The labeling works perfectly, however I'm still facing some rendering issues with the WorkingHour Bars. After rescheduling a task by dragging it (and in some cases even on startup) they do not align any more (i.e. Working hours do not visually match). Please see the following example using example FGTemplatizedForWorkingHours4.5 and the compiled 4.5_v6.5.4.1 you sent me.
(http://i.imgur.com/fzRP2ss.png)
(http://i.imgur.com/OFKz3N1.png)
Kind regards,
Michael
-
Michael,
We seem to have trouble reproducing this issue. Just so we are both looking at the same data, could you replace this line in the sample:
// In GetSampleData method
DateTime dtS = TimeComputingUtils.ToUtcKind(DateTime.Today - TimeSpan.FromDays(3));
with a concrete date (instead of based on Today), make sure you can reproduce the issue and then update us?
If you changed anything else in the sample, please do send the whole project to us.
Thanks
RQ Support
-
Hi,
I tried with a concrete date which delivers the same error. But thanks to your hint I found the source.
The only line I changed in the sample project was TasksDontStartAndEndInNonWorkingTime= in xaml which is not included any more in the custom version 6.5.4.1 you sent me via email on 27.10.2014, thus leading to a compilation error if I hadn't deleted it. If you set the TasksDontStartAndEndInNonWorkingTime="True" the error will occur in your sample file too.
The error is visible if you shift Team1 - Resource2 just ever so slightly to the right or left. Also for Team3 - Resource2 you see that the bar is rendered improperly already on startup where the working hour Bar renders in the gray SAT/SUN area of Nov 8.-9.
Please also refer to my previous thread which addresses this issue.
http://newforum.radiantq.com/index.php?topic=15.0
In the custom version you sent me the presented solution is not applicaple since the inclusion of TasksDontStartAndEndInNonWorkingTime in the xaml leads to a compilation error but apparently in the background this defaults to true.
Kind regards,
Michael
-
Michael,
Yes, there is no TasksDontStartAndEndInNonWorkingTime in the latest version.
We are however not seeing this issue in Team1-Resource 2 or Team3-Resource2. So, can you please do the below we requested in our previous update:
>>>>>>>>>>
Just so we are both looking at the same data, could you replace this line in the sample:
// In GetSampleData method
DateTime dtS = TimeComputingUtils.ToUtcKind(DateTime.Today - TimeSpan.FromDays(3));
with a concrete date (instead of based on Today), make sure you can reproduce the issue and then update us?
>>>>>>>>>>
Thanks
RadiantQ Support
-
Hi,
Very strange :)
I tested it with an actual date and am still facing the issue. I just sent you an email with src together with the FlexyGannt version I am using as well as two current screenshots. I hope it is easier to reconstruct the error that way.
Thanks for your time and effort,
Michael
-
Michael,
In the MainPage constructor we had requested you to make these changes, once you do that bars render much better. Could you confirm:
// Don't set WorkTimeSchedule anymore on the gantt.
//this.fxgantt.WorkTimeSchedule = WorkTimeSchedule.Schedule8X5;
// This will force the entire bar to be rendered, even the portions that are not visible.
this.fxgantt.ApplyBarWidthOptimization = false;
Thanks
Support
-
Hi,
Including this in the example file leads to the same errourous behaviour -> Bars are rendered correctly on startup but as soon as I drag a bar just a little, the rendering fails.
Can you confirm this behaviour?
Thanks
-
Michael,
We will email you shortly a video of what the bars look like when we move them around. Unfortunately, we can''t seem to reproduce! Can you load the gantt with the offending starttime and endtime that is causing this issue and share with us?
Thanks
Support
-
The
//this.fxgantt.WorkTimeSchedule = WorkTimeSchedule.Schedule8X5; really was the issue's solution.
I must have overread it at first :-[
Thanks very much for your patience and sorry for the inconvenience!
Kind regards
Michael