How to Draw Controls on Top of TX Text Control .NET for WPF
Some WPF controls such as PopUps, ComboBoxes or ToolTips are always on top of the WPF layer. WPF.TextControl implements the same approach - a separate independent Window is required to provide the true WYSIWYG rendering. But due to the fact that WPF.TextControl uses a similar approach, you can use the same work-around to draw other controls on top of these controls. The above mentioned elements including TextControl have their own Window which is always displayed on top of other controls. To…

Some WPF controls such as PopUps, ComboBoxes or ToolTips are always on top of the WPF layer. WPF.TextControl implements the same approach - a separate independent Window is required to provide the true WYSIWYG rendering.
But due to the fact that WPF.TextControl uses a similar approach, you can use the same work-around to draw other controls on top of these controls. The above mentioned elements including TextControl have their own Window which is always displayed on top of other controls. To render a control on top of these controls, you need to encapsulate them in their own Window.
The following code shows how to create and display a Window on top of WPF.TextControl. The container Window itself can have any kind of WPF children:
TextWindow testWindow = new TextWindow();
testWindow.Width = 200;
testWindow.Height = 200;
testWindow.Owner = Window.GetWindow(this);
testWindow.ShowInTaskbar = false;
testWindow.WindowStyle= WindowStyle.None;
testWindow.AllowsTransparency = true;
testWindow.Background = Brushes.Transparent;
Point relativePoint = textControl1.TransformToAncestor(this).Transform(
new System.Windows.Point(0, 0));
testWindow.Left = relativePoint.X + this.Left;
testWindow.Top = relativePoint.Y + this.Top + 50;
testWindow.Show();
Related Posts
Create a Table of Contents in Windows Forms using C#
This article explains how to create a table of contents in Windows Forms using the ribbon or programmatically. Creating a table of contents is required to organize large documents.
Official TX Text Control .NET Sample Applications Are Now Hosted on GitHub
This article gives a quick overview of the new repositories, their structure and our plans for the future.
ASP.NETJavaScriptDocument Editor
Detect Toggle Button Changes Using a MutationObserver
This article shows how to detect changes of toggle buttons in the ribbon of the web editor using a MutationObserver. The state of a toggle button in the ribbon visualizes the state of a certain…
Two Ways to Restart Numbered Lists in TX Text Control
In TX Text Control, numbered lists are continued by default and need to be reset when required. There is more than one way if you want to restart numbered lists in a document. In this article, two…
Zoom Tricks: Disabling CTRL + MOUSE WHEEL and More
This article shows how to disable CTRL + MOUSE WHEEL, implement zooming with keyboard and reset the zoom factor to its default value.