Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Expand input field of ShapeNode while typing (Read 2375 times)
Patrik
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 7
Joined: Aug 22nd, 2012
Expand input field of ShapeNode while typing
Nov 14th, 2012 at 8:49am
Print Post  
Hi!

We wonder if there is a way to dynamically expand the input field (textbox?) of the editable shape node while typing in text?

/Patrik
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Expand input field of ShapeNode while typing
Reply #1 - Nov 14th, 2012 at 9:08am
Print Post  
Hi,

That's possible by handling EnterInplaceEditMode and TextChanged events:

Code
Select All
double originalWidth;

private void OnEnterInplaceEditMode(object sender, InPlaceEditEventArgs e)
{
	e.TextBox.TextChanged += OnInplaceTextChanged;
	originalWidth = e.TextBox.Width;
}

void OnInplaceTextChanged(object sender, TextChangedEventArgs e)
{
	var textBox = (TextBox)sender;
	textBox.ClearValue(WidthProperty);
	textBox.Measure(
		new Size(double.PositiveInfinity, double.PositiveInfinity));
	textBox.Width = Math.Max(textBox.DesiredSize.Width, originalWidth);
} 



I hope that hepls,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint