I have a base class like that in the project A
namespace WpfApplication1
{
/// <summary>
/// Interaktionslogik für Layer.xaml
/// </summary>
public partial class Layer
{
public Layer()
{
InitializeComponent();
}
}
}
with this xaml (in my project it has a complex tooltip, but for simplicity I changed it to a TextBlock)
<Canvas x:Class="WpfApplication1.Layer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Canvas.ToolTip>
<TextBlock Text="ToolTip"/>
</Canvas.ToolTip>
</Canvas>
For testing purpose I want to derive from that in my TestAssembly
using WpfApplication1;
namespace WpfApplication2
{
public class TestingLayer : Layer
{
}
}
But when I start I get the the
The component `TestingLayer` does not have a resource identified by the URI `/WpfApplication1;component/layer.xaml`
I already googled and found some threads related to that problem, but with some differences:
This one suggests to make a wrapper around TestingLayer
but unfortunately this doesn't work for me because I want to get access to some protected funtions (especially to OnRender
whose access I can't modify). Furthermore the OP wants a derived control with xaml, and this is a big difference to my needs, because my derived class has no xaml. This difference also applies to these threads
Since the derivation works when I create TestingLayer
in my project A
I think there is just a problem in the URI. But I don't know how to solve it.
To sum it up: How to derive a c# class with only a cs file from a control (with xaml) from another assembly?