designTime Update ?

이와 같은 Custom Control Class가 있습니다.
동적으로 Column 과 Row를 추가해주고 있는데요,
Build를 하지 않은 상태에서 wpf designer에서 동적으로 추가된 항목들이 update 되어 보이질 않네요,
어떤 부분 때문일까요 ?

++추가
Build 해서 실행시키면 정상적으로 Display 됩니다.

1 Like

BlockGrid_Loaded() 메서드를

생성자에서 직접 호출해보시겠어요?

2 Likes

변화가 없는 것 같습니다.

1 Like

테스트 해봤는데 정상 적으로 나옵니다.

DefinitionLoad() 메서드 코드에

if (!DesignerProperties.GetIsInDesignMode(this))

디자인 모드 실행이 아닐 경우만 로직 처리 되도록 되어 있습니다.
해당 분기 제거하면 잘 나옵니다.

수정한 코드 입니다.

public BlockGrid()
{
    if (!DesignerProperties.GetIsInDesignMode(this))
    {
        this.Loaded += BlockGrid_Loaded;
    }
    else
    {
        this.BlockGrid_Loaded(this, new RoutedEventArgs());
    }
}

추가로, private void DefinitionLoad() 내용에
if (!DesignerProperties.GetIsInDesignMode(this)/* && ColumnCount > 0 && RowCount > 0*/)
분기 제거


[xaml 디자이너 화면]

[xaml 코드]
image

2 Likes

앗 되었습니다!!
디자이너가 생각보다 빠르게 반응을 안해서 안보여졌었던것 같네요!

감사합니다

1 Like