custom control binding 오류 관련 문의

안녕하세요. Custom Control을 만들고 있는 중 바인딩은 잘 되고 있는데 바인딩 오류가 계속 발생해서 문의드립니다.

발생하는 오류는 다음과 같습니다.
대상 요소의 관리하는 FrameworkElement 또는 FrameworkContentElement를 찾을 수 없습니다.

해당 소스코드는 다음과 같습니다.
NuemorphismBase.xaml

<DropShadowEffect x:Key="FirstDropShadowEffect"
    BlurRadius="{Binding FirstBlurRadius, RelativeSource={RelativeSource TemplatedParent}}"                     
    ShadowDepth="{Binding FirstShadowDepth, RelativeSource={RelativeSource TemplatedParent}}"                     
    Direction="{Binding FirstDirection, RelativeSource={RelativeSource TemplatedParent}}"                     
    Color="{Binding FirstBackgroundBrush, RelativeSource={RelativeSource TemplatedParent}}"/>

<DropShadowEffect x:Key="SecondeDropShadowEffect"   BlurRadius="{Binding SecondBlurRadius, RelativeSource={RelativeSource TemplatedParent}}" 
                                                    ShadowDepth="{Binding SecondShadowDepth, RelativeSource={RelativeSource TemplatedParent}}" 
                                                    Direction="{Binding SecondDirection, RelativeSource={RelativeSource TemplatedParent}}" 
                                                    Color="{Binding SecondBackgroundBrush, RelativeSource={RelativeSource TemplatedParent}}"/>
<Style TargetType="{x:Type ui:NuemorphismBase}">
    <Setter Property="Background" Value="{StaticResource DefaultBackground}"/>
    <Setter Property="Width" Value="100"/>
    <Setter Property="Height" Value="100"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ui:NuemorphismBase}">
                <Border x:Name="FirstBorder" 
                        Background="{TemplateBinding Background}"  
                        CornerRadius="{TemplateBinding FirstBorderCornerRadius}" 
                        Effect="{StaticResource FirstDropShadowEffect}" >
                    <Grid x:Name="grid">
                        <Border x:Name="SecondBorder" 
                                Background="{TemplateBinding Background}" 
                                CornerRadius="{TemplateBinding SecondBorderCornerRadius}" 
                                Effect="{StaticResource SecondeDropShadowEffect}">
                        </Border>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

NuemorphismBase.cs (해당 클래스는 ContentControl을 상속받았습니다.)

public static CornerRadius DefaultFirstBorderCornerRadius = new CornerRadius(20);
public static readonly DependencyProperty FirstBorderCornerRadiusProperty =
    DependencyProperty.Register(
        "FirstBorderCornerRadius",
        typeof(CornerRadius),
        typeof(NuemorphismBase),
        new PropertyMetadata(DefaultFirstBorderCornerRadius));

public CornerRadius FirstBorderCornerRadius
{
    get => (CornerRadius)GetValue(FirstBorderCornerRadiusProperty);
    set => SetValue(FirstBorderCornerRadiusProperty, value);
}

public static Color DefaultFirstBackgroundBrush = new Color() { A = 33, R = 0xD1, G = 0xD9, B = 0xE6 }; //"#33D1D9E6"
public static readonly DependencyProperty FirstBackgroundBrushProperty =
    DependencyProperty.Register(
        "FirstBackgroundBrush",
        typeof(Color),
        typeof(NuemorphismBase),
        new PropertyMetadata(DefaultFirstBackgroundBrush));

public Color FirstBackgroundBrush
{
    get => (Color)GetValue(FirstBackgroundBrushProperty);
    set => SetValue(FirstBackgroundBrushProperty, value);
}
...

위의 이미지처럼 dependencyproperty로 설정한 모든 속성에서 오류가 발생합니다…

기능상에는 문제가 없지만 잘못된 방향으로 가니 오류가 발생하는 것으로 생각됩니다. 오류를 없앨 수 있는 방안이 있다면 도와주세요
감사합니다!

재현이 되지는 않으나 위 부분을 DynamicResource로 바꿔보시죠.
실제 리소스가 참조 되기 전 StaticResource로 생성되는 과정에서 발생하는 것으로 추측됩니다.

2개의 좋아요

제가 참 멍청하네요… dynamicResource로 변경해서 바인딩오류 안떠서 해결했다 생각했습니다. 하지만 다른업무 보고 다시 보니 ui에 전시가 되지 않네요… 혹시 다른 방법은 없을까요…?

이상하군요. StaticReseource로 바꾸면 다시 잘 나오나요?

넵 staticResource로 변경하면 다시 잘 나옵니다.

이미지 오른쪽 전체 에러 메시지가 어떻게 되나요?

대상 요소의 관리하는 FrameworkElement 또는 FrameworkContentElement를 찾을 수 없습니다.
이 멘트만 있습니다!