Reputation: 2626
I am trying to customise the Extended WPF Toolkit's RichTextBoxFormatBar
tool as I want to take away some out of the box functionality.
I have created a Custom Control and copied the original tool source code into Themes\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"
Stretch="Fill"
StrokeDashArray="1,2"
StrokeThickness="1"
X1="0"
X2="1"
Margin=".5">
<Line.Stroke>
<SolidColorBrush Color="Gray" />
</Line.Stroke>
</Line>
<Line SnapsToDevicePixels="True"
Stretch="Fill"
StrokeDashArray="1,2"
StrokeThickness="1"
X1="0"
X2="1"
Margin=".5">
<Line.Stroke>
<SolidColorBrush Color="Gray" />
</Line.Stroke>
</Line>
<Line SnapsToDevicePixels="True"
Stretch="Fill"
StrokeDashArray="1,2"
StrokeThickness="1"
X1="0"
X2="1"
Margin=".5">
<Line.Stroke>
<SolidColorBrush Color="Gray" />
</Line.Stroke>
</Line>
</StackPanel>
</Border>
</ControlTemplate>
design blah blah design
</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>
Sorry, lot of Xaml!
I have Ises.FormatBar.cs
which holds all my code behind/logic and inherits from Control.
When I try to view the Designer for Generic.xaml
I get no designer and the message 'Intentionally Left Blank. The document root element is not supported by the visual designer.'
Probably an issue with my xaml code not being bound properly to Ises.FormatBar.cs
?
Upvotes: 0
Views: 925
Reputation: 17509
When I try to view the Designer for Generic.xaml I get no designer and the message 'Intentionally Left Blank.
This is fine. It's because you are trying to view a ResourceDictionary in a designer.
Is that the only issue? I would also make a guess that when you use this custom control into some other user control, you are not getting to see the expected view.
Ideally, you shouldn't be including "x:Key="IsesFormatTemplate" in your custom control style. So that it get's applied to all usages without having to include the style explicitly. Either remove the key, or include Style="{StaticResource IsesFormateTemplate}"
in all the usages.
Upvotes: 1