To reproduce: - Add DiagramRibbonBar to a user control. - Try setting the AssociatedControl from the smart tag. - An error message will be shown. Workaround: Set it in code: radDiagramRibbonBar1.AssociatedDiagram = radDiagram1;
To reproduce: add a RadDiagram and use the following code snippet:
this.radDiagram1.PanToPosition(new Telerik.Windows.Diagrams.Core.Point(10,10));
Workaround: subscribe to the Pan event:
this.radDiagram1.Pan += radDiagram1_Pan;
void radDiagram1_Pan(object sender, Telerik.WinControls.UI.Diagrams.PositionChangedRoutedEventArgs e)
{
}
How to reproduce: check the attached video - unexpected-behavior.gif
To reproduce:
Bind using a binding source:
DataSet ds = new DataSet();
ds.Tables.Add(shapesTable);
ds.Tables.Add(connectionsTable);
BindingSource bindingSource1 = new BindingSource { DataSource = ds };
radDiagram1.DiagramElement.DataLayer.DataSource = bindingSource1;
Workaround:
Bind directly:
DataSet ds = new DataSet();
ds.Tables.Add(shapesTable);
ds.Tables.Add(connectionsTable);
radDiagram1.DiagramElement.DataLayer.DataSource = ds;
Please refer to the attached sample project. If you drag a new shape or copy/paste an existing one it is not added to the DataSource collection as it is added in RadGanttView for example. Workaround: handle the ItemsChanged event and add a new record to the DataSource manually.
By using these events the user will be able to easily cancel moving of a shape in certain conditions.
To reproduce
- Click between the thumb and the button.
Workaround:
public class MyDiagramInputBehavior : DiagramInputBehavior
{
public MyDiagramInputBehavior(RadDiagramElement element) : base(element)
{
}
protected override bool IsScrollBar(RadElement element)
{
if (element != null && element is RadScrollBarElement)
{
return true;
}
return base.IsScrollBar(element);
}
}
How to reproduce:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
RadDiagramShape shape1 = new RadDiagramShape()
{
Text = "Second Level Domain",
ElementShape = new RoundRectShape(4),
BackColor = Color.LimeGreen
};
shape1.Position = new Telerik.Windows.Diagrams.Core.Point(100, 100);
radDiagram1.Items.Add(shape1);
var res = radDiagram1.Items[0];
((Telerik.WinControls.UI.Diagrams.RadDiagramItem)shape1).EndEdit += item_EndEdit;
RadDiagramShape shape2 = new RadDiagramShape()
{
Text = "Top Level Domain",
ElementShape = new RoundRectShape(50),
BackColor = Color.Cyan
};
shape2.Position = new Telerik.Windows.Diagrams.Core.Point(1600, 100);
radDiagram1.Items.Add(shape2);
RadDiagramShape shape3 = new RadDiagramShape()
{
Text = "Organization Domain",
ElementShape = new RoundRectShape(20),
BackColor = Color.Yellow
};
shape3.Position = new Telerik.Windows.Diagrams.Core.Point(2400, 100);
radDiagram1.Items.Add(shape3);
RadDiagramConnection connection1 = new RadDiagramConnection() { Name = "connection1" };
connection1.Source = shape1;
connection1.Target = shape2;
radDiagram1.Items.Add(connection1);
RadDiagramConnection connection2 = new RadDiagramConnection()
{
Name = "connection2"
};
connection2.Source = shape2;
connection2.Target = shape3;
radDiagram1.Items.Add(connection2);
}
private void item_EndEdit(object sender, Telerik.WinControls.UI.Diagrams.RadRoutedEditEventArgs e)
{
RadDiagramShape shape = ((RadDiagramShape)sender);
string txt = shape.Text;
Size size = TextRenderer.MeasureText(txt, shape.Font, new System.Drawing.Size( (int)shape.Width, int.MaxValue ), ~TextFormatFlags.SingleLine);
shape.Height = size.Height;
}
private void radButton1_Click(object sender, EventArgs e)
{
this.radDiagram1.DiagramElement.BringIntoView(radDiagram1.Items[0], this.radDiagram1.Zoom, false);
}
private void radButton2_Click(object sender, EventArgs e)
{
this.radDiagram1.DiagramElement.BringIntoView(radDiagram1.Items[1], this.radDiagram1.Zoom, false);
}
private void radButton3_Click(object sender, EventArgs e)
{
this.radDiagram1.DiagramElement.BringIntoView(radDiagram1.Items[2], this.radDiagram1.Zoom, false);
}
}
Workaround: manually update the view
private void radButton1_Click(object sender, EventArgs e)
{
this.radDiagram1.DiagramElement.BringIntoView(radDiagram1.Items[0], this.radDiagram1.Zoom, false);
this.radDiagram1.DiagramElement.Controller.OnViewportChanged();
}
private void radButton2_Click(object sender, EventArgs e)
{
this.radDiagram1.DiagramElement.BringIntoView(radDiagram1.Items[1], this.radDiagram1.Zoom, false);
this.radDiagram1.DiagramElement.Controller.OnViewportChanged();
}
private void radButton3_Click(object sender, EventArgs e)
{
this.radDiagram1.DiagramElement.BringIntoView(radDiagram1.Items[2], this.radDiagram1.Zoom, false);
this.radDiagram1.DiagramElement.Controller.OnViewportChanged();
}
To reproduce: - Add shape and zoom the view. - Call the method: radDiagram1.DiagramElement.BringIntoView(radDiagram1.Shapes[0]); Workaround: radDiagram1.DiagramElement.BringIntoView(radDiagram1.Shapes[0],radDiagram1.Zoom, false);
To reproduce:
- Zoom the diagram and drop an item from the toolbox.
Workaround:
Friend Class MyToolbox
Inherits RadDiagramToolbox
Protected Overrides Sub DragDropService_PreviewDragDrop(ByVal sender As Object, ByVal e As RadDropEventArgs)
'base.DragDropService_PreviewDragDrop(sender, e);
Dim shape = TryCast(GetType(RadDiagramToolbox).GetField("shape", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance).GetValue(Me), RadDiagramShape)
Dim diagramElement As RadDiagramElement = TryCast(e.HitTarget, RadDiagramElement)
Dim containerShape As RadDiagramContainerShape = TryCast(e.HitTarget, RadDiagramContainerShape)
If containerShape IsNot Nothing Then
diagramElement = containerShape.FindAncestor(Of RadDiagramElement)()
End If
If diagramElement Is Nothing OrElse diagramElement.Shape IsNot Nothing OrElse shape Is Nothing Then
Return
End If
e.Handled = True
Dim zoom As Double = diagramElement.Zoom
Dim m As Telerik.WinControls.Layouts.RadMatrix = diagramElement.MainPanel.Transform
m.Invert()
Dim position = New Telerik.Windows.Diagrams.Core.Point(m.DX + (e.DropLocation.X - shape.Width \ 2) * 1 / zoom, m.DY + (e.DropLocation.Y - shape.Height \ 2) * 1 / zoom)
If containerShape IsNot Nothing Then
position.X += containerShape.Position.X
position.Y += containerShape.Position.Y
End If
shape.Position = position
diagramElement.AddShape(shape, Nothing, True)
If containerShape IsNot Nothing Then
DirectCast(containerShape, IContainerShape).AddItem(shape)
End If
shape = Nothing
End Sub
End Class
The user is not allowed to add a shape or edit an existing one by using the TextTool: http://docs.telerik.com/devtools/winforms/diagram/diagram-tools/text-tool Workaround: Me.RadDiagramRibbonBar1.buttonTextTool.Visibility = Telerik.WinControls.ElementVisibility.Collapsed
To reproduce:
- Add some shapes and call the BringToView method
Private Sub RadButton4_Click(sender As Object, e As EventArgs) Handles RadButton4.Click
Dim ds As RadDiagramShape
For i As Integer = 0 To Me.RadDiagram1.Shapes.Count - 1
If i = 2 Then
ds = DirectCast(RadDiagram1.Shapes(i), RadDiagramShape)
Me.RadDiagram1.DiagramElement.BringIntoView(ds, 1.0, True)
Exit For
End If
Next
End Sub
Workaround:
Me.RadDiagram1.DiagramElement.BringIntoView(ds, 1.0, False)