Solved

How do I allow users to resize dynamically created textboxes in WPF

Posted on 2008-10-13
2
1,234 Views
Last Modified: 2013-11-12
I'm building a tool as a method for learning WPF, its a form creator where I'm allowing users to dynamically add labels, textboxes, etc.  

With my current code the user can add a textbox and drag and drop the textbox anywhere they like.  Now I need to give he user the ability to resize the textbox.  Is that possible?  Ideally I'd like to give the user the little dots on all sides to allow them to drag the textbox bigger.

Thanks in advance!
0
Comment
Question by:dndorksadmin
2 Comments
 
LVL 8

Accepted Solution

by:
adler77 earned 500 total points
ID: 22709012
I'm coming at this from the Silverlight side, so there may be a more elegant way in WPF (or SL for that matter!), but what if the TextBlock was wrapped in a Grid that is custom-styled with Rectangle "handles" in the right places. Those handles have drag/drop code that repositions/resizes the Grid when you release the mouse button. With the Grid resized, the TextBlock should autosize to fit the Grid.

Would this work for what you need?
0
 

Author Comment

by:dndorksadmin
ID: 22711705
Hmm, that makes a lot of sense.  I'm actually decorating objects when I drag them at the four corners, so perhaps it won't take much to add code to handle resizing the object.  I'll take a look at it tonight when I get home!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now