Hi All,
I'm using more or less default setup of the XamTimeLine, just having a Metro theme on top, setting up my text in the event title and customizing some colors.
I use the numeric double values for the Time and Duration of the events. The values are rounded to 2 decimal places before assignment to the properties (that are bound to the NumericTimeSeries in a pretty straigtforward way: DataMapping="Time=Start;Title=Title;Details=Title;Duration=Length").
Now my issue is, XamTimeLine makes an internal calculation of the End value of the interval which results in unrounded double value and it is shown on the event title of the event (see screenshot below). Question is, can I somehow round this End value (this is purely cosmetic issue, but pretty annoying).
Thanks a lot in advance!
Kind regards,
Dmitrii
Hello Dmitrii,
I have been investigating into the behavior you are seeing, and I would recommend taking a look at the following documentation articles about formatting numeric values in the XamTimeline control, as I believe it should help you to provide a format to the label: https://es.infragistics.com/help/wpf/xamtimeline-format-numeric-time-values.
Please let me know if you have any other questions or concerns on this matter.
Hi Andrew!
Thanks a lot for a quick and precise finding!
This indeed solves my issue with the event titles. Unfortunatelly it creates another issue
It also affects how the timeline scale is drawn, this means it applies the given format also to the values along the timeline scale (see picture below).
Is there any way to only apply the format to the values inside the event title and to keep the timeline scale without any format?
P.S: I know probably I ask too much, but...
Thanks a lot!
Hello Andrew,
I'm not a big fan of retemplating the IG controls at all, because you introduce this way a point of no return on a long run, i.e. if IG is going to bugfix/modify the styles you never know this happened and still live in your old style after 5-10 years. But thank you for the suggestion, this eventually pushed me to a right direction.
Of course my main problem was not knowing all the options of the string format in .NET. I was using 0:F2, while the right one in my case would be 0:0.##
This solved the main thing, but brought me to the next issue. When you just override the full LabelStyle, you're losing the defaults for the Metro theme, like the font size (and it looks ugly). Luckily the styles for the XamTimeLine are made in a very good way with the keys (which is not always the case for the other controls) and it is possible to simply base on the default Metro style for the AxisLabel.
So, for the ones who need it, here is what I was looking for:
<Style x:Key="axisFormatStyle" TargetType="ig:AxisLabel" BasedOn="{StaticResource AxisLabelStyle}"> <Setter Property="StringFormat" Value="{}{0:0.##}" /> </Style>
Thanks a lot once again!
Thank you for your update on this matter. It does appear that unfortunately, this will apply the formatting to your event title and the timeline.
I have been investigating further into this, and there are multiple ways to put together the XamTimeline, so it is difficult for me to make a concrete recommendation in this case. Would it be possible for you to provide an isolated sample that demonstrates the timeline in the screenshot so I may look into this under the configuration that you are putting the XamTimeline together in?
One thing that I did come up with, but I’m not certain if it would really be necessary in this case is to re-template the EventTitle object. Since you mentioned that you are applying the Metro theme, the default template for the XamTimeline objects can be found in the Metro.xamTimeline.xaml file commonly found at the following directory with Infragistics for WPF controls installed:
C:\Program Files (x86)\Infragistics\<version>\WPF\Themes\Metro