2
나는 아주 단순 연결된 속성 만든 :건물 + 스타일 첨부> 경우 ArgumentNullException
: XAML에서이 완벽하게 잘 작동 설정
public static class ToolBarEx
{
public static readonly DependencyProperty FocusedExProperty =
DependencyProperty.RegisterAttached(
"FocusedEx", typeof(bool?), typeof(FrameworkElement),
new FrameworkPropertyMetadata(false, FocusedExChanged));
private static void FocusedExChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is ToolBar)
{
if (e.NewValue is bool)
{
if ((bool)e.NewValue)
{
(d as ToolBar).Focus();
}
}
}
}
public static bool? GetFocusedEx(DependencyObject obj)
{
return (bool)obj.GetValue(FocusedExProperty);
}
public static void SetFocusedEx(DependencyObject obj, bool? value)
{
obj.SetValue(FocusedExProperty, value);
}
}
을, 그러나 나는 스타일 내에서 설정을 시도하는 경우
런타임 중에 ArguemntNullException을 수신합니다 ("값은 null 일 수 없습니다. 매개 변수 이름 :.. 재산 ") 내가 여기에 무엇이 잘못되었는지 알아낼 수 없습니다
는 어떤 힌트 appriciated됩니다
이
예외가 발생하면 스택 추적을보십시오. 그러면 코드가 실패한 위치를 찾을 수 있습니다. 그래도 문제를 해결할 수 없다면 스택 트레이스를 질문과 함께 게시하십시오. –