Wpf 我的Customcontrols找不到转换器

Wpf 我的Customcontrols找不到转换器,wpf,Wpf,我在app.xaml中声明了一些转换器,如下所示 <Application.Resources> <ResourceDictionary> <conv:PhotoParamsConverter x:Key="PhotoParamsConverter" /> . . . . </ResourceDictionary> </Application.Resources> . . . . 如果我在

我在app.xaml中声明了一些转换器,如下所示

<Application.Resources>
        <ResourceDictionary>

            <conv:PhotoParamsConverter x:Key="PhotoParamsConverter" />
.
.
.
.
</ResourceDictionary>
</Application.Resources>

.
.
.
.
如果我在用户控件中使用它,效果会很好

<Rectangle RenderTransformOrigin="0.5,0.5">
    <Rectangle.Fill>
        <ImageBrush Stretch="UniformToFill" RenderOptions.BitmapScalingMode="HighQuality">
            <ImageBrush.ImageSource>
                <MultiBinding Converter="{StaticResource PhotoParamsConverter}">
                    <Binding Path="Personne.ADH_PHOTO" />
                    <Binding Path="Personne.ADH_GENDER" />
                </MultiBinding>
            </ImageBrush.ImageSource>
        </ImageBrush>
    </Rectangle.Fill>
</Rectangle>

但在自定义控件(generic.xaml)中,我遇到了一个异常:

找不到staticResource PhotoParamsConverter等

任何想法都欢迎


谢谢

自定义控件是一个可重用的控件,可用于各种不相关的项目中。在自定义控件本身中引用程序集,它肯定会工作

您可以改为使用DynamicSource,或者将转换器declaration移动到与自定义控件相同的XAML文件中

添加该答案,以便我可以验证:)我猜这是少数WPF wierdness内容中的一部分。。。。我已经将转换器声明添加到generic.xaml中,然后它就工作了:)至少在我上次尝试时,转换器不允许使用DynamicSource。