Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Customising the RichTextBoxFormatBar

$
0
0
Thanks. I have created a Custom Control, used the xaml source code in Themes/Generic.xaml and created the necessary .cs files from the source code. IsesFormatBar.cs is the control file which inherits from Control.

Here is my Generic.xaml:
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
    xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters;assembly=Xceed.Wpf.Toolkit" 
    xmlns:MyNamespace="clr-namespace:IsesTextEditor">

    <conv:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />

    <ControlTemplate TargetType="{x:Type MyNamespace:IsesFormatBar}" x:Key="IsesFormatTemplate">
        <Border Background="Transparent"
              Cursor="Hand"
              ToolTip="Click to Drag">
            <StackPanel VerticalAlignment="Center"
                     Width="75">
                <Line SnapsToDevicePixels="True"
etc etc
</StackPanel>

                </StackPanel>
            </Grid>
        </Border>
    </ControlTemplate>

    <!-- =================================================================== -->
    <!-- Style                                                               -->
    <!-- =================================================================== -->
    <Style TargetType="{x:Type MyNamespace:IsesFormatBar}">
        <Setter Property="Template"
              Value="{StaticResource richTextBoxFormatBarTemplate}" />
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect BlurRadius="5"
                              Opacity=".25" />
            </Setter.Value>
        </Setter>
        <Setter Property="Background"
              Value="Transparent" />
        <Setter Property="IsTabStop"
              Value="false" />
    </Style>
</ResourceDictionary>
I cannot view the tool design in the designer of Generic.xaml, I am getting the message 'Intentionally Left Blank. The document root element is not supported by the visual designer'.

Any ideas?

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>