WPF의 개인 내부 클래스에서 자원을 선언하는 방법은 무엇입니까?
-
06-07-2019 - |
문제
WPF Usercontrol에서 리소스를 선언하려고 노력하고 있으며 리소스가 개인 내부 클래스의 인스턴스가되기를 바랍니다. 어떻게해야합니까?
XAML :
<UserControl ...>
<UserControl.Resources>
<local:MyConverter x:Key="MyConverter" />
</UserControl.Resources>
</UserControl>
뒤에 코드 :
public partial class MyUserControl : UserControl
{
private class MyConverter : IValueConverter
{
// convertion code...
}
}
해결책
수업이 비공개라면 그렇게 할 수 없습니다. 대신 내부로 만들 수 있습니다.
XAML의 내부 클래스 선언과 관련하여, 당신은 이 토론
제휴하지 않습니다 StackOverflow