Hallo,
I'd like to ask about my problem. I have app where i'm working with tabControl and RadDiagram. First RadDiagram is created in xaml code and it's loaded manualy with some logic from the xml file. DragDrop logic is based on your DragDrop tutorial and it's working fine. But when i try create diagram manualy behind the code with my own method which is defining the most important things in diagram i don't know how to make it works with my DragDropBehavior Class.
How could i define dragDrop:DragDropBehaviorRadDiagram.IsEnabled="True" behind code when i'm create new diagram?
thank you for your time and advices
Grettings
Jakub Rautner
private
RadDiagram CreateNewDiagram()
{
RadDiagram dgrm =
new
RadDiagram();
// Events handlers
dgrm.ShapeDoubleClicked +=
new
EventHandler<ShapeRoutedEventArgs>(diagram_ShapeDoubleClicked);
dgrm.MouseDoubleClick +=
new
MouseButtonEventHandler(diagram_MouseDoubleClick);
dgrm.SelectionChanged +=
new
SelectionChangedEventHandler(diagram_SelectionChanged);
dgrm.ZoomChanged +=
new
EventHandler<RadRoutedPropertyChangedEventArgs<
double
>>(diagram_ZoomChanged);
DragDropManager.AddDropHandler(dgrm, OnDrop);
dgrm.Style =
this
.Resources[
"diagramStyle"
]
as
Style;
dgrm.ShapeStyleSelector = xGrid.Resources[
"CustomShapeStyleSelector"
]
as
NodeStyleSelector;
dgrm.ConnectionStyleSelector = xGrid.Resources[
"CustomConnectionStyleSelector"
]
as
LinkStyleSelector;
dgrm.LayoutAsync(LayoutType.Tree, TreeSettings);
dgrm.IsDraggingEnabled =
true
;
dgrm.AllowDrop =
true
;
return
dgrm;
}
Here' s definition RadDiagram in xaml file: dragDrop is namespace where i have created DragDropBehavior logic for TreeView and RadDiagram
<
telerik:RadDiagram
x:Name
=
"diagram"
Grid.Row
=
"0"
ShapeStyleSelector
=
"{StaticResource CustomShapeStyleSelector}"
ConnectionStyleSelector
=
"{StaticResource CustomConnectionStyleSelector}"
Style
=
"{StaticResource diagramStyle}"
ZoomChanged
=
"diagram_ZoomChanged"
IsZoomEnabled
=
"True"
MouseDoubleClick
=
"diagram_MouseDoubleClick"
AllowDrop
=
"True"
dragDrop:DragDropBehaviorRadDiagram.IsEnabled
=
"True"
ShapeDoubleClicked
=
"diagram_ShapeDoubleClicked"
SelectionChanged
=
"diagram_SelectionChanged"
>
<
primitives:ItemInformationAdorner.AdditionalContent
>
<
telerik:SettingsPane
x:Name
=
"xSettingsPane"
Diagram
=
"{Binding ElementName=diagram}"
>
</
telerik:SettingsPane
>
</
primitives:ItemInformationAdorner.AdditionalContent
>
</
telerik:RadDiagram
>