resizable inline control (using adornments)

SyntaxEditor for WPF Forum

Posted 6 years ago by tal
Version: 13.2.0592
Avatar

Hi,

I am looking at the IntraTextAdornmentManager Sample, and I'm tring to make a resizable Tag - I want to add a UserControl inline as a small control and when the user drags the corner (using a Thumb) it should change its size and consequently move the text so it won't run it over...

I made the Size property in the tag as a DependencyProperty (making it a DependencyObject) and then i added binding to the code (myObj is INotifyPropertyChanged and i call PropertyChangedEventHandler with Size):

Binding myBinding = new Binding("Size");
myBinding.Source = myObj;
myBinding.Mode = BindingMode.OneWay;
BindingOperations.SetBinding(tag, IntraTextTag.SizeProperty, myBinding);

after this line runs, the program gets stuck (on the next line that ineracts with the editor).

(if it's any simpler it's supposed to take one complete line so only the height matters...)

 

Am i doing it wrong?

What is the proper way to make a resizable inline control?

 

Thanks,

Tal

Comments (5)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tal,

Updates to properties on the tag won't take effect until the editor re-renders things.  You can trigger a render by calling the tagger's IntraTextNotesTagger.RaiseTagsChanged method for the tag range that the tag covers.  That will trigger a new layout pass for that range and should pick up your resized area.


Actipro Software Support

Posted 6 years ago by tal
Avatar

Hi,

It worked like a charm, thanks!

But I encountered a problem: when the size of the Tag is set with relative big numbers (when the window and the editor is maximized and it fits inside the editor), after I make the window smaller (consequently the editor gets smaller then the size of the tag) the entire program gets stuck...

(regardless of the resizing)

Is this a bug or is there something I'm doing wrong here?

Thanks again,

Tal

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tal,

It's hard to say without something to debug that shows the issue.  If you'd like us to look into it, please make a new simple sample project that shows the problem and e-mail that over with repro steps to our support address.  Please reference this post and rename the .zip file extension so it doesn't get spam blocked.  Thanks!


Actipro Software Support

Posted 6 years ago by tal
Avatar

Hey,

Sorry for the delay,

I'm pretty sure that in order to replicate the situation you could just do the following:
In SyntaxEditor - General QuickStarts: Adornments 6 - Code Reviewing

In MainControl.xaml.cs line 46, in OnAddNoteButtonClick I changed the line:
tag.Size = new Size(30, 18);
to:
tag.Size = new Size(300, 300);

And added the next two lines in IntraTextNoteAdornmentManager.cs after line 137, in AddAdornment:
button.Height = 300;
button.Width = 300;

Now run the sample, add an adornment at the beginging of the text while the window itself is maximized.
Then resize the window in both directions to a smaller one (height and width),
Continue until the entire button defined earlier cannot appear completely in the view (because the view should be smaller than 300 by 300).

You should notice that the entire program is stuck and nothing helps until CTRL+ALT+DEL and process terminate is being used.
Making the editor smaller in just one aspect at a time doesn't freeze the program, only when both height and width cannot be drawn completely it stops functioning.

Is that ok now?

Thanks

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tal,

I'm trying this with our latest version (2014.1) and don't see any lockups.  Are you able to repro it in that version?

If so, please make a new simple sample project that shows it and email it to our support address so we can debug exactly what you see.  Be sure to rename the .zip file extension.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.