or
<
DataTemplate
x:Key
=
"RadPaneHeaderTemplate"
DataType
=
"{x:Type telerikDocking:RadPane}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding}"
ToolTip
=
"{Binding ElementName=DocumentPane, Path=Tag, Mode=OneWay}"
/>
</
StackPanel
>
</
DataTemplate
>
<
telerikDocking:RadDocumentPane
x:Name
=
"DocumentPane"
HeaderTemplate
=
"{StaticResource RadPaneHeaderTemplate}"
Header
=
"{Binding Path=DocumentHeader}"
Tag
=
"{Binding Path=DocumentToolTip}"
telerikDocking:RadDocking.SerializationTag
=
"DocumentPane"
HorizontalContentAlignment
=
"Left"
CanUserClose
=
"False"
DataContext
=
"{Binding}"
>
<
telerik:RadDocking
telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled
=
"True"
>
<
telerik:RadDocking.RootCompassStyle
>
<
Style
TargetType
=
"telerik:RootCompass"
>
<
Setter
Property
=
"IsCenterIndicatorVisible"
Value
=
"False"
/>
<
Setter
Property
=
"IsTopIndicatorVisible"
Value
=
"False"
/>
<
Setter
Property
=
"IsBottomIndicatorVisible"
Value
=
"False"
/>
</
Style
>
</
telerik:RadDocking.RootCompassStyle
>
<
telerik:RadDocking.CompassStyle
>
<
Style
TargetType
=
"telerik:Compass"
>
<
Setter
Property
=
"IsCenterIndicatorVisible"
Value
=
"False"
/>
<
Setter
Property
=
"IsTopIndicatorVisible"
Value
=
"False"
/>
<
Setter
Property
=
"IsBottomIndicatorVisible"
Value
=
"False"
/>
</
Style
>
</
telerik:RadDocking.CompassStyle
>
<
telerik:RadDocking.DocumentHost
>
<
telerik:RadBusyIndicator
IsBusy
=
"{Binding LayoutLoaded,Converter={StaticResource BooleanInverter}}"
DockPanel.Dock
=
"Left"
BusyContent
=
"Loading Layout..."
IsIndeterminate
=
"True"
>
<
c:TabControlEx
x:Name
=
"ItemTabControl"
ItemsSource
=
"{Binding Tabs}"
SelectedItem
=
"{Binding ActiveTab}"
Loaded
=
"ItemTabControl_Loaded"
Padding
=
"0"
Style
=
"{StaticResource BlueTabControlEx}"
/>
</
telerik:RadBusyIndicator
>
</
telerik:RadDocking.DocumentHost
>
<
telerik:RadSplitContainer
InitialPosition
=
"DockedLeft"
Width
=
"285"
>
<
telerik:RadPaneGroup
>
<
telerik:RadPane
Header
=
"Toolbox"
IsPinned
=
"False"
>
<
v:NewToolboxView
BorderBrush
=
"#385d8a"
BorderThickness
=
"2"
DataContext
=
"{Binding Toolbox}"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocking
>
using
System;
using
System.Windows;
namespace
Scratch
{
using
System.Collections.ObjectModel;
using
Telerik.Windows.Controls.GanttView;
using
Telerik.Windows.Controls.Scheduling;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
var ts =
new
ObservableCollection<IGanttTask>();
gantt.VisibleRange =
new
DateRange(DateTime.Now.AddMinutes(0), DateTime.Now.AddMinutes(6));
gantt.PixelLength =
new
TimeSpan(0,0,0,1);
gantt.TasksSource = ts;
var a =
new
GanttTask { Start = DateTime.Now.AddMinutes(0), End = DateTime.Now.AddMinutes(6), Title =
"A"
};
var b =
new
GanttTask { Start = DateTime.Now.AddMinutes(0), End = DateTime.Now.AddMinutes(1), Title =
"B"
};
var c =
new
GanttTask { Start = DateTime.Now.AddMinutes(2), End = DateTime.Now.AddMinutes(6), Title =
"C"
};
var d =
new
GanttTask { Start = DateTime.Now.AddMinutes(2), End = DateTime.Now.AddMinutes(3), Title =
"D"
};
var e =
new
GanttTask { Start = DateTime.Now.AddMinutes(4), End = DateTime.Now.AddMinutes(6), Title =
"E"
};
var f =
new
GanttTask { Start = DateTime.Now.AddMinutes(5), End = DateTime.Now.AddMinutes(6), Title =
"F"
};
ts.Add(a);
a.Children.Add(b);
a.Children.Add(c);
c.Children.Add(d);
c.Children.Add(e);
e.Children.Add(f);
// The error occours In the below lines (when E is moved)
c.Children.Remove(d);
a.Children.Add(d);
c.Children.Remove(e);
a.Children.Add(e);
}
}
}
<
Window
x:Class
=
"Scratch.MainWindow"
xmlns:Controls
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GanttView"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Controls:RadGanttView
x:Name
=
"gantt"
/>
</
Grid
>
</
Window
>
var startIndex = collectionChangedAction == NotifyCollectionChangedAction.Remove ? oldStartingIndex : newStartingIndex;
var newWrappers = newItemsCollection !=
null
? newItemsCollection.OfType<HierarchicalItem>() : Enumerable.Empty<HierarchicalItem>();
var newItemsCount = newItemsCollection !=
null
? newItemsCollection.Count : 0;
var oldWrappers = oldItemsCollection !=
null
? oldItemsCollection.OfType<HierarchicalItem>() : Enumerable.Empty<HierarchicalItem>();
var oldItemsCount = oldItemsCollection !=
null
? oldItemsCollection.Count : 0;
var removedWrappers = oldWrappers.SelectMany(Flatten).ToArray();
var addedWrappers = newWrappers.SelectMany(Flatten).ToArray();
var sourceCollectionItemsCountDifference = newItemsCount - oldItemsCount;
var childrenCountDifference = addedWrappers.Length - removedWrappers.Length - sourceCollectionItemsCountDifference;
for
(
int
i = startIndex + newItemsCount; i < targetCollection.Count; i++)
{
targetCollection[i].previousChildrenCount += childrenCountDifference;
targetCollection[i].SourceItemIndex += sourceCollectionItemsCountDifference;
}
var previousChildrenCount = startIndex > 0 ? targetCollection[startIndex - 1].previousChildrenCount + targetCollection[startIndex - 1].visibleChildrenCount : 0;
foreach
(var newWrapper
in
newWrappers)
{
newWrapper.previousChildrenCount += previousChildrenCount;
previousChildrenCount += newWrapper.visibleChildrenCount;
}
Rectangle rectangle =
new
Rectangle();
rectangle.Width = Math.Max(0, (endInline.BoundingRectangle.Location.X - startInline.BoundingRectangle.Location.X));
rectangle.Height = startInline.LineInfo.Height;
Canvas.SetTop(rectangle, startInline.ControlBoundingRectangle.Top - (startInline.LineInfo.Height / 1.5));
Canvas.SetLeft(rectangle, startInline.BoundingRectangle.Left);
rectangle.Fill = FillBrush;
rectangle.Opacity = MouseOverHighlightLayer.MouseOutOpacity;
rectangle.MouseEnter += (s, e) => { ((Rectangle)s).Opacity = MouseOverHighlightLayer.MouseInOpacity; };
rectangle.MouseLeave += (s, e) => { ((Rectangle)s).Opacity = MouseOverHighlightLayer.MouseOutOpacity; };