This is a migrated thread and some comments may be shown as answers.

Timeline Group Sorting

11 Answers 172 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
ilusha
Top achievements
Rank 1
ilusha asked on 21 Mar 2014, 10:03 AM
Hello!
I've implemented DragAndDrop behavior for my TimeLine. But my timelineitemssource have several groups. When I drag items inside the group all  is right. Start time in source are changing and visualization occured. My next goal is realise DragAndDrop between groups. And the goal is reached. But sometimes (I can't understand why) group soring is changed. Images attached. I have DataAnnotaion on timeline and it's height and margins depends on groups. When sorting changed occured all my logic breaks. Can you tell me when group sorting occured and what is the rule of sorting. If Group sorting can be disabled it's will be super!
Sorry for my English.

11 Answers, 1 is accepted

Sort by
0
ilusha
Top achievements
Rank 1
answered on 24 Mar 2014, 06:17 AM
Unfortunately I can't find the solution still. Maybe anyone has this trouble too?  
0
Accepted
Tsvetie
Telerik team
answered on 24 Mar 2014, 09:53 AM
Hi Ilusha,

The order of the groups in the RadTimeline control depends on the order in which they appear in the ItemsSource. That is, in case you have the following ItemsSource:
  1. Item0 from Group0
  2. Item1 from Group1
  3. Item2 from Group2
, you will see the groups in the following order - Group0, Group1, Group2.

And in case you have the following ItemsSource:

  1. Item0 from Group2
  2. Item1 from Group1
  3. Item2 from Group0
, you will see the groups in the following order - Group2, Group1, Group0.

That is why, in case you want to ensure the order of the groups in the RadTimeline control, you can sort the ItemsSource before passing it to the RadTimeline control. You need to do this every time you change the ItemsSource.

On a side note, your solution sounds interesting and other users might find it useful. In case you want to, you can share it with the Telerik community by posting it as a Code Library.  In case you decide to do this, we can award you for your time and effort with Telerik points.

 


Regards, Tsvetie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
ilusha
Top achievements
Rank 1
answered on 24 Mar 2014, 10:45 AM
Greate Thanks for your answer! I'll try it soon and reply again!
0
ilusha
Top achievements
Rank 1
answered on 24 Mar 2014, 12:17 PM
Greate thanks! It's great solution! One more question. Is there any way to customize group template? For example change the color of lines and etc. And Is it possible to know height from one group line to another and group line Canvas.top? 

 

 
0
Accepted
Tsvetie
Telerik team
answered on 26 Mar 2014, 06:42 PM
Hello Ilusha,

You could create a custom template for the TimelineGroupPeriodControl. For additional information on customizing the built-in control templates, please refer to our online documentation.

Regarding the height of the groups of items - you could get the ActualHeight of the TimelineGroupPeriodControl instance. However, groups are arranged by a custom panel and not a Canvas. That is why, the only way to get the offset of one group from the top of the RadTimeline control, is to sum the height of all previous groups.

Regards,
Tsvetie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
ilusha
Top achievements
Rank 1
answered on 27 Mar 2014, 06:08 AM
Thank you very much!!!
0
ilusha
Top achievements
Rank 1
answered on 31 Mar 2014, 07:35 AM
Excuse me again!
You've sad 'you could get the ActualHeight of the TimelineGroupPeriodControl instance'. But I can't find way to get this instance from my radTimeline. How can I get this object from my TimeLine (for example name of my Timeline is RadTimeline1).
Thanks!
0
Tsvetie
Telerik team
answered on 02 Apr 2014, 03:21 PM
Hi Ilusha,

You can get a reference to all TimelineGroupPeriodControl instances of a RadTimeline control using the ChildrenOfType extension method.

Regards,
Tsvetie
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
ilusha
Top achievements
Rank 1
answered on 05 Jun 2014, 12:36 PM
Hello! 
A'm came back to my work and have one more question about radtimeline. Could you please help me about group height again.
I have 3 groups (pic1) and i've got TimelineGroupPeriodControl instances (MainTimeline is my instance of radtimeline):

                var e = MainTimeline.ChildrenOfType<TimelineGroupPeriodControl>().ToList();
                e.ForEach(control =>
                {
                    var str = control.ActualHeight.ToString(CultureInfo.InvariantCulture);
                    builder.AppendLine(str);
                });
                MessageBox.Show(builder.ToString());

When the control is in state such as pic1 this code returns me result: 15, 15, 15;
When the items intersecs such as pic2 this code return me 15, 15, 15 too.
But the actual height of period groups is differnt in this 2 cases. How can I get the actualHeight of group. And groupName (скл... in my case) too.
Thanks!

0
ilusha
Top achievements
Rank 1
answered on 05 Jun 2014, 12:40 PM
And one more qustion. With the new version of teleik wpf cotrols (2014) the radtimeline throws an exception in XAML visual designer. The stack trace is:

XamlParseException: TargetType "RadSlider" is not match the type of element "TimelineScrollBar".

 в System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
   в System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
   в System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   в System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
   в System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   в System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   в System.Windows.FrameworkElement.ApplyTemplate()
   в System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   в System.Windows.UIElement.Measure(Size availableSize)
   в System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   в System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   в System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   в System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   в System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   в System.Windows.UIElement.Measure(Size availableSize)
   в MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   в System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   в System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   в System.Windows.UIElement.Measure(Size availableSize)
   в System.Windows.Controls.Border.MeasureOverride(Size constraint)
   в System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   в System.Windows.UIElement.Measure(Size availableSize)
   в System.Windows.Controls.Control.MeasureOverride(Size constraint)
   в System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   в System.Windows.UIElement.Measure(Size availableSize)
0
Tsvetie
Telerik team
answered on 09 Jun 2014, 03:46 PM
Hello Ilusha,

I am afraid I have misled you. The name of the class that represents the groups of items is TimelineItemGroupControl. That is why, your code should look like the following code snippet:
var groups = this.RadTimeline1.ChildrenOfType<TimelineItemGroupControl>().ToList();
 
StringBuilder builder = new StringBuilder();
 
foreach (var group in groups)
{
    var str = group.ActualHeight.ToString(CultureInfo.InvariantCulture);
    builder.AppendLine(str);
}
 
MessageBox.Show(builder.ToString());

Regarding the design-time exception - unfortunately, I was not able to reproduce it. In case the problem persists, please open a new support ticket and send me a simple running project, demonstrating the problem.

Regards,
Tsvetie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
TimeLine
Asked by
ilusha
Top achievements
Rank 1
Answers by
ilusha
Top achievements
Rank 1
Tsvetie
Telerik team
Share this question
or