XAML: 속성 'Resources'가 두 번 이상 설정되었습니다.
다음의 에러가 표시됩니다.
'Resources' 속성이 두 번 이상 설정되었습니다.
XAML은 다음과 같습니다.
<UserControl.Resources>
<!--Resource dictionaries for framework stuff-->
<ResourceDictionary>
<Style x:Key="MultiLineTextBox" TargetType="TextBox">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="TextWrapping" Value="WrapWithOverflow"/>
</Style>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/View;component/Common/ResourceDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<!--Convertors needed for proper display-->
<c:CollapsedIfNegative x:Key="CollapseIfNegative"/>
<c:VisibleIfNegative x:Key="MakeVisibleIfNegative"/>
<c:ErrorCodeToString x:Key="ConvertErrorCodeToString"/>
</UserControl.Resources>
그.Resources
Xaml의 속성은 영리하다: 타입ResourceDictionary
하지만, 만약 당신이 명시적으로<ResourceDictionary>
그 내용을 태그하면 컴파일러가 마법처럼 추정합니다.그래서 보통 붓을 바로 마크업에 넣을 수 있어요.
하지만, 당신은 당신 자신의 것을 넣는 것으로 시작했습니다.ResourceDictionary
그래서 컴파일러는 당신이 두 개 이상의 값을 설정하려고 한다고 생각합니다.이렇게 다시 쓰면 원하는 결과를 얻을 수 있습니다.
<UserControl.Resources>
<!--Resource dictionaries for framework stuff-->
<ResourceDictionary>
<!--Convertors needed for proper display-->
<!-- move this INSIDE the ResourceDictionary tag -->
<c:CollapsedIfNegative x:Key="CollapseIfNegative"/>
<c:VisibleIfNegative x:Key="MakeVisibleIfNegative"/>
<c:ErrorCodeToString x:Key="ConvertErrorCodeToString"/>
<Style x:Key="MultiLineTextBox" TargetType="TextBox">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="TextWrapping" Value="WrapWithOverflow"/>
</Style>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/View;component/Common/ResourceDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
실제로 XAML을 복사하여 사용자 제어에 붙여넣으면 문제없이 구축됩니다(참조된 변환기 클래스를 추가할 경우).
에러 리스트에 다른 에러가 표시됩니까?아니면 이 에러만 표시됩니까?리소스를 찾지 못하는 등 다른 오류가 발생하면 다른 컴파일 오류가 발생할 수 있습니다.
언급URL : https://stackoverflow.com/questions/3425720/xaml-the-property-resources-is-set-more-than-once
'programing' 카테고리의 다른 글
오류: "샌드박스가 Podfile.lock과 동기화되지 않았습니다."RestKit를 고치와 함께 설치한 후 (0) | 2023.04.15 |
---|---|
Python을 사용하여 MS Office 매크로를 프로그래밍하고 있습니까? (0) | 2023.04.15 |
해시 세트 대퍼포먼스 일람 (0) | 2023.04.15 |
앱이 백그라운드에서 돌아왔을 때 viewApp이 호출되지 않는 이유는 무엇입니까? (0) | 2023.04.15 |
디렉토리내의 파일의 경우, 에코 파일명(경로 없음)만을 사용합니다. (0) | 2023.04.15 |