4
키를 열거 형으로 사용하고 값을 사용자 지정 개체로 사용하는 사용자 지정 사전이 있습니다. 이 객체를 xaml에 바인딩해야합니다. 그래서 내가 어떻게 할 수 있니? 내가하고 싶은 것은XAML에서 enum 값에 액세스하는 방법
,
내가 시도 것을<Button Content="{Binding ButtonGroups[my enum value].Text}"></Button>
,
<Button Content="{Binding ButtonGroups[local:MyEnum.Report].Text}"></Button>
<Button Content="{Binding ButtonGroups[x:Static local:MyEnum.Report].Text}">
</Button>
<Button Content="{Binding ButtonGroups[{x:Static local:MyEnum.Report}].Text}">
</Button>
그러나 위의 코드는 열거 값을 표시하고 다음은 내꺼 위해 일하지 않고, 열거 파일
<Button Content="{x:Static local:MyEnum.Report}"></Button>
,
,public enum MyEnum
{
Home,
Report
}
내 사전,
IDictionary<MyEnum, Button> ButtonGroups
는 .text } "/>',하지만 훨씬 쉽습니다 :) 그리고'Text'는 버튼의 속성이 아닙니다. 해당 컬렉션에는 사용자 지정 개체가 들어 있으며 해당 사용자 지정 개체에는 'Text'라는 속성이 있습니다. 빠른 답장과 답변을 주셔서 감사합니다 –
문제 없음 :) 해피 코딩 –