Hello,
I came across two bugs in the RadDocking system. I cannot create a bug report in the PITS because I get redirected to the general support page (perhaps because I am using the Telerik trial?).
1. In the example below I use a simple RadDocking. I dock a pane in a ToolWindow (Left or Right), undock it and dock it in the same ToolWindow (Top or Bottom). For some reason, the whole ToolWindow disappears after doing this.
2. In the second RadDocking, a custom IGeneratedItemsFactory is used to inject custom docking items. Somehow, after performing the same steps as before, a RadSplitContainer is inserted into the docking system instead of my custom MySplitContainer. This should not happen, because I am using a custom IGeneratedItemsFactory that should take care of it.
Here is the XAML for the MainPage:
Here is the code for the classes that are used to reproduce the bugs:
I used Telerik RadControls Q3 2011 to reproduce the bugs.
Maybe the two bugs are related, seeing as they involve the same steps to reproduce them. Anyways, the second bug in particular is bothering me because I have to do a lot of work to correct for its behavior (I have to transfer the content and style properties of the RadSplitContainer to a new MySplitContainer, unhook the RadSplitContainer from its parent, hook up the MySplitContainer to that parent and try not to cause an OnContentChanged or ItemsChanged event in the process).
I hope I have provided enough information.
Kind regards,
Beijerinc
I came across two bugs in the RadDocking system. I cannot create a bug report in the PITS because I get redirected to the general support page (perhaps because I am using the Telerik trial?).
1. In the example below I use a simple RadDocking. I dock a pane in a ToolWindow (Left or Right), undock it and dock it in the same ToolWindow (Top or Bottom). For some reason, the whole ToolWindow disappears after doing this.
2. In the second RadDocking, a custom IGeneratedItemsFactory is used to inject custom docking items. Somehow, after performing the same steps as before, a RadSplitContainer is inserted into the docking system instead of my custom MySplitContainer. This should not happen, because I am using a custom IGeneratedItemsFactory that should take care of it.
Here is the XAML for the MainPage:
<
UserControl
x:Class
=
"RadDockingBugs.MainPage"
xmlns:telerikdocking
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
xmlns:dockingbugs
=
"clr-namespace:RadDockingBugs"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
UserControl.Resources
>
<
dockingbugs:DockingItemsFactory
x:Key
=
"ItemsFactory"
/>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<!-- Perhaps both bugs are related? -->
<
telerikdocking:RadDocking
Grid.Row
=
"0"
>
<
telerikdocking:RadSplitContainer
InitialPosition
=
"FloatingDockable"
telerikdocking:RadDocking.FloatingLocation
=
"200,50"
>
<
telerikdocking:RadPaneGroup
>
<
telerikdocking:RadPane
Header
=
"Bug 1"
>
<
telerikdocking:RadPane.Content
>
<
StackPanel
Orientation
=
"Vertical"
>
<
TextBlock
Text
=
"Both panes and the ToolWindow will disappear if you do the following:"
TextWrapping
=
"Wrap"
/>
<
TextBlock
Text
=
"- Take this pane, dock it left or right in 'Test Pane Number 1'."
TextWrapping
=
"Wrap"
Margin
=
"10 5 0 5"
/>
<
TextBlock
Text
=
"- Take this pane out and dock it top or bottom in 'Test Pane Number 1', with or without intermediate drop and redrag."
TextWrapping
=
"Wrap"
Margin
=
"10 0 0 0"
/>
</
StackPanel
>
</
telerikdocking:RadPane.Content
>
</
telerikdocking:RadPane
>
</
telerikdocking:RadPaneGroup
>
</
telerikdocking:RadSplitContainer
>
<
telerikdocking:RadSplitContainer
InitialPosition
=
"FloatingDockable"
telerikdocking:RadDocking.FloatingLocation
=
"500,50"
>
<
telerikdocking:RadPaneGroup
>
<
telerikdocking:RadPane
Header
=
"Test Helper 1"
Content
=
"Test Pane Number 1"
/>
</
telerikdocking:RadPaneGroup
>
</
telerikdocking:RadSplitContainer
>
</
telerikdocking:RadDocking
>
<
telerikdocking:RadDocking
Grid.Row
=
"1"
GeneratedItemsFactory
=
"{StaticResource ItemsFactory}"
>
<
telerikdocking:RadSplitContainer
InitialPosition
=
"FloatingDockable"
telerikdocking:RadDocking.FloatingLocation
=
"200,500"
>
<
telerikdocking:RadPaneGroup
>
<
telerikdocking:RadPane
Header
=
"Bug 2"
>
<
telerikdocking:RadPane.Content
>
<
StackPanel
Orientation
=
"Vertical"
>
<
TextBlock
Text
=
"With a custom IGeneratedItemsFactory, a RadSplitContainer is inserted instead of a MySplitContainer if you do the following:"
TextWrapping
=
"Wrap"
/>
<
TextBlock
Text
=
"- Take this pane, dock it left or right in 'Test Pane Number 2'."
TextWrapping
=
"Wrap"
Margin
=
"10 5 0 5"
/>
<
TextBlock
Text
=
"- Take this pane out and dock it top or bottom in 'Test Pane Number 2', with or without intermediate drop and redrag."
TextWrapping
=
"Wrap"
Margin
=
"10 0 0 0"
/>
</
StackPanel
>
</
telerikdocking:RadPane.Content
>
</
telerikdocking:RadPane
>
</
telerikdocking:RadPaneGroup
>
</
telerikdocking:RadSplitContainer
>
<
telerikdocking:RadSplitContainer
InitialPosition
=
"FloatingDockable"
telerikdocking:RadDocking.FloatingLocation
=
"500,500"
>
<
telerikdocking:RadPaneGroup
>
<
telerikdocking:RadPane
Header
=
"Test Helper 2"
Content
=
"Test Pane Number 2"
/>
</
telerikdocking:RadPaneGroup
>
</
telerikdocking:RadSplitContainer
>
</
telerikdocking:RadDocking
>
</
Grid
>
</
UserControl
>
Here is the code for the classes that are used to reproduce the bugs:
public
class
DockingItemsFactory : IGeneratedItemsFactory
{
#region Factory Methods
public
ToolWindow CreateToolWindow()
{
return
new
MyToolWindow();
}
public
RadSplitContainer CreateSplitContainer()
{
return
new
MySplitContainer();
}
public
RadPaneGroup CreatePaneGroup()
{
return
new
MyPaneGroup();
}
#endregion
}
public
class
MyToolWindow : ToolWindow
{
#region Events
protected
override
void
OnContentChanged(
object
oldContent,
object
newContent)
{
base
.OnContentChanged(oldContent, newContent);
// This is a scenario I am using in another project. I need to know if a docking operation has occurred, so I use custom
// split containers and pane groups that have ItemsChanged events. You can imagine the problem when a RadSplitContainer
// is found instead of a MySplitContainer. I have to transfer the content (and style properties) to a new MySplitContainer,
// detach the RadSplitContainer from its parent and substitute it with the MySplitContainer. In the mean time, I have to
// be careful not to trigger an OnContentChanged or ItemsChanged event, to prevent looping.
MySplitContainer oldSplitContainer = (MySplitContainer)oldContent;
MySplitContainer newSplitContainer = (MySplitContainer)newContent;
if
( oldSplitContainer !=
null
)
{
oldSplitContainer.ItemsChanged -= MySplitContainer_ItemsChangedHandler;
}
if
(newSplitContainer !=
null
)
{
newSplitContainer.ItemsChanged += MySplitContainer_ItemsChangedHandler;
}
}
private
void
MySplitContainer_ItemsChangedHandler(
object
sender, EventArgs e)
{
MySplitContainer splitContainer = (MySplitContainer)sender;
// If there is any child split container that is not a MySplitContainer but -is- a RadSplitContainer, an error in the ToolWindow
// children buildup process must have occurred.
if
(splitContainer.Items.Where(x => !(x
is
MySplitContainer) && x
is
RadSplitContainer).Any())
{
throw
new
InvalidCastException(
"A RadSplitContainer sneaked into the MyToolWindow children!"
);
}
}
#endregion
}
public
class
MySplitContainer : RadSplitContainer
{
#region Events
public
event
EventHandler ItemsChanged;
protected
void
NotifyItemsChanged()
{
if
(ItemsChanged !=
null
)
{
ItemsChanged(
this
,
new
EventArgs());
}
}
protected
override
void
OnItemsChanged(NotifyCollectionChangedEventArgs e)
{
base
.OnItemsChanged(e);
NotifyItemsChanged();
}
#endregion
}
public
class
MyPaneGroup : RadPaneGroup
{
}
I used Telerik RadControls Q3 2011 to reproduce the bugs.
Maybe the two bugs are related, seeing as they involve the same steps to reproduce them. Anyways, the second bug in particular is bothering me because I have to do a lot of work to correct for its behavior (I have to transfer the content and style properties of the RadSplitContainer to a new MySplitContainer, unhook the RadSplitContainer from its parent, hook up the MySplitContainer to that parent and try not to cause an OnContentChanged or ItemsChanged event in the process).
I hope I have provided enough information.
Kind regards,
Beijerinc