Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p><em>Note: I answered this <strong>before</strong> the posted had the <strong>WinForms</strong> tag in their question. (I actually added it based on his reply here.) Still, if you're using WPF, this is how you'd do it...</em></p> </blockquote> <p>The easiest thing to do is to replace the ControlTemplate with your internal implementation. In other words, you're replacing the 'visual' portions of the RichTextBox control but you're still a RichTextBox control.</p> <p>For instance, this is how I replaced the visuals of a TextBox to completely strip away all the chrome and leave it with nothing more but a simple border. But it was still a full TextBox with all properties, etc.</p> <p>Again, look up Control Templating. You may also want to search for 'Lookless Controls'.</p> <pre><code>&lt;Style TargetType="{x:Type glc:EditableTextBlock2}" BasedOn="{StaticResource {x:Type TextBox}}"&gt; &lt;Setter Property="VerticalContentAlignment" Value="Center" /&gt; &lt;Setter Property="MinWidth" Value="20" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type glc:EditableTextBlock2}"&gt; &lt;Border Name="Bd" SnapsToDevicePixels="True" BorderThickness="1" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Border.Background}" &gt; &lt;ScrollViewer Name="PART_ContentHost" SnapsToDevicePixels="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload