-2
我创建了一个简单的自定义控制,具有图像和文本WPF自定义控件不更新
如果我开始它的工作原理像它应该的PROGRAMM,但在编辑器中它不是视觉上的更新,但我不知道为什么
这里是控制Custom Control Image
继承人一切背后的代码
public string Text
{
get
{
return MenuText.Text;
}
set
{
MenuText.Text = value;
}
}
public Brush FontColor
{
get
{
return MenuText.Foreground;
}
set
{
MenuText.Foreground = value;
}
}
public ImageSource Image
{
get
{
return Icon.Source;
}
set
{
Icon.Source = value;
}
}
在WPF式的控制方面,你都应该使用更复杂的“DependencyProperties”(https://www.wpftutorial.net/DependencyProperties.html)。可能是你没有使用它们。不过,我大多猜测给你至少一个答案。 – Christopher