The shape's minheight is 60, The name of the object displays on the bottom of the shape, when zoom out the shape, the name string may word wrap, so the shape's minheight is increase by a new line's height, but when resizeing, the minheight of the bounds is not change,
how to solve this problem?
thanks!
5 Answers, 1 is accepted
Thank you for the provided picture.
I am not familiar with your application set-up but I am assuming that you are changing the MinHeight of the shape in ZoomChanged event. Correct me if I am wrong. What I can suggest you is to subscribe to the SizeChangedEvent and change the MinHeight of the shapes. Check the following code snippets.
public
MainWindow()
{
InitializeComponent();
EventManager.RegisterClassHandler(
typeof
(RadDiagramShape), RadDiagramShape.SizeChangedEvent,
new
RoutedEventHandler(OnSizeChanged));
}
private
void
OnSizeChanged(
object
sender, RoutedEventArgs e)
{
var diagramShape = sender
as
RadDiagramShape;
diagramShape.MinHeight = 90;
}
Hope this approach will work in your main application.
Regards,
Dinko
Progress Telerik
Hi Dinko,
Thanks for your reply, I think I didn't describe it clearly
The shape's MinHeight changed correct,but the MinHeight of resizeing bounds(the dotted rectangle in the attached second picture) is not change, the MinHeight of the bounds seems fixed at the beginning of resize, the related code as follows:
<Style x:Key="SquidShapeStyle"
TargetType="telerik:RadDiagramShape">
...
<Setter Property="MinHeight"
Value="{Binding MinHeight}" />
<Setter Property="MinWidth"
Value="{Binding MinWidth}" />
...
</Style>
this.diagram.ServiceLocator.Register<IResizingService>( new CustomResizingService(this.diagram));
public class CustomResizingService : ResizingService
{
List<IDiagramItem> _selectedItems;
public CustomResizingService(RadDiagram owner)
: base(owner as IGraphInternal)
{
Resizing += CustomResizingService_Resizing;
}
public override void InitializeResize(IEnumerable<IDiagramItem> newSelectedItems, double adornerAngle, Rect adornerBounds, ResizeDirection resizingDirection, Point startPoint)
{
_selectedItems = newSelectedItems.ToList();
base.InitializeResize(newSelectedItems, adornerAngle, adornerBounds, resizingDirection, startPoint);
}
}
void CustomResizingService_Resizing(object sender, ResizingEventArgs e)
{
foreach (var item in _selectedItems)
{
var shape = item as RadDiagramShape;
if (shape == null) continue;
var squidNode = shape.DataContext as SquidNode;
squidNode.Squid.Location_x = (int)item.Bounds.X;
squidNode.Squid.Location_y = (int)item.Bounds.Y;
squidNode.Squid.Squid_width = item.Bounds.Width;
squidNode.Squid.Squid_height = Math.Max(item.Bounds.Height, squidNode.MinHeight);
}
}
}
Thank you for the provided code snippet. Can you try setting the mode of the MinHeight and MinWidth binding to TwoWay?
<
Style
x:Key
=
"SquidShapeStyle"
TargetType
=
"telerik:RadDiagramShape"
>
<
Setter
Property
=
"MinHeight"
Value
=
"{Binding MinHeight,Mode=TwoWay}"
/>
<
Setter
Property
=
"MinWidth"
Value
=
"{Binding MinWidth,Mode=TwoWay}"
/>
</
Style
>
Regards,
Dinko
Progress Telerik
Thanks for your reply, The problem still exists.
I think I will need additional information in order to better understand your scenario. From the attached pictures in your first reply, I can see that you had use custom shape or you have a custom style for that shape. Can you send me the template of the custom shape or any custom style which you have applied to the shape? This way I could try to reproduce this visuazalition on my side. Also, can you confirm that you are using the latest version of our controls?
Regards,
Dinko
Progress Telerik