MarkupLabel - is it still there?

SyntaxEditor for WPF Forum

Posted 12 years ago by Kasper
Version: 11.2.0554
Avatar

Hi guys,

With SyntaxEditor for WinForms, I could use the MarkupLabel control to show HTML based strings outside of IntelliPrompt/QuickInfo windows. This was really cool, but I can't seem to find the MarkupLabel in the WPF suite? Is it hidden in there somewhere under a different name, or is it not exposed like it previously was? I would really appreciate if you could make it available to us again :)

Comments (5)

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

Hi Kasper,

We don't have a control like that any more but similar functionality is still available.  If you look at this documentation topic (SyntaxEditor IntelliPrompt Features / Content Providers), it talks about the HtmlContentProvider at the lower portion.  That is what you'd use, and actually the last example code snippet shows how you'd use it.  When you call its GetContent method, you can set that result to any ContentPresenter's content and it will achieve the same effect as MarkupLabel.


Actipro Software Support

Posted 12 years ago by Kasper
Avatar

That works perfectly! I had already checked out that example, but I didn't know that it could provide content for a ContentProvider control like that. Thanks for the tip :)

Posted 12 years ago by Kasper
Avatar

Okay, I guess it works perfect for everything but images. When I do this and my markup includes images, the image is scaled to a very big size, for some reason. The image is simply an icon (16x16) and yet it's blown up to fill the entire area. I looked in the documentation, but as far as I can tell, there's no way to specify a height or a width. This can be produced very easily with a ContentProvider in a Window and an HtmlContentProvider implementation like this one:

public class HtmlContentProviderExt : HtmlContentProvider
{
	public HtmlContentProviderExt(string htmlSnippet) : base(htmlSnippet) { }

	protected override Image GetImage(string source)
	{
		Image img = new Image();
		BitmapImage bmpImg = new BitmapImage();
		bmpImg.BeginInit();
		bmpImg.UriSource = new Uri("pack://application:,,,/ActiproImageSizeIssue;component" + source);
		bmpImg.EndInit();
		img.Source = bmpImg;
		return img;
	}
}

 I use it like this:

HtmlContentProviderExt provider = new HtmlContentProviderExt("<img src=\"/accept.png\" />");
cpTest.Content = provider.GetContent();

 This is not a problem when I use it with e.g. QuickInfo, but perhaps that's because the control used there is limited in height? In this case I need to be able to span the content for several lines and therefore have the images show up in their actual size (16x16 in this situation). What to do? :)

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

Hi Kasper,

When we insert the Image, we just wrap it within an InlineUIContainer and never touch sizes or anything.  One thing our default image loading code does though is this:

img.Stretch = Stretch.None;

Maybe try doing that as well on yours to see if it helps.

[Modified 12 years ago]


Actipro Software Support

Posted 12 years ago by Kasper
Avatar

That was just the cure I was looking for. Thank you! :)

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.