This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi! We've implemented automatic nodes resizing, as you advised here http://www.mindscapehq.com/forums/thread/3207571. However, we noticed the resizing works differently for various nodes. For some nodes the size fits contents perfectly (blue in attached screenshot), but for others there's a visible gap between content and node border (red). The behaviour is repeatable - we get the same results for the same nodes. How can we ensure the resize fits contents perfectly in all cases? |
|
|
Hello, My best guess is there may be some margin or padding somewhere in the template causing the bounds of the node to be wider than the text contents. If not, please send a simple repro project that demonstrates this issue, or the xaml and C# code that I could use to reproduce the issue. -Jason Fauchelle |
|
|
Hello, I have finally managed to repro this one, on a stripped down version of our app. If you load it up, it will add some static nodes to the diagram surface and when you do an 'Auto Resize' it will arrange them nicely, except the width of the diagram nodes should be all the same and it isn't for some reason. I couldn't attach the file to this post, but you can find it here. Thanks for your help. -Hadi |
|
|
Hi Hadi, Thanks for the repro project, I'm not sure I understand the issue though. You've set up the node template to resize based on the bounds of the content, which it seems to be doing as I'd expect. Though you mention that all the nodes in the demo should be the same width. Could you please explain how the nodes should be the same width - perhaps by posting an image or pointing out bits in the template. Once I understand, I'll be able to solve this. -Jason Fauchelle |
|
|
Hi, Sorry the sample wasn't quite adequate to show the problem. Please have a look at the image attached. I have made a slight change to the code to generate that if you could drop it in the same app sent before, you should get the same thing. The issue is that, even though the diagram nodes should resize to its content, it is a bit larger than its content. I have marked the area that I'm talking about in the image with red arrow. Thanks for your help, Hadi |
|
|
Hi Hadi, Thanks for the clarification, I understand now. This issue is being caused by the * sizing on the ColumnDefinition at line 314 of MessageFlowView.xaml. Since you want the width of the node to be entirely controlled by the content, I think it will be suitable to change the * here to Auto. The result looks fine from what I can see. * sizing is somewhat the reverse behaviour of having a known parent size to cause the child to fill the available space. I can see why you'd want to use * sizing here though. One way to keep the * sizing would be to remove the columns from the root grid, and then wrap all the center row contents in another grid that can keep the column definitions you currently use. That does mean an extra Grid element though. Another alternative may be to align the 3rd column content to the right, I haven't tried this though. Hope that helps. Let me know if you have further questions about this. -Jason Fauchelle |
|