그냥 열거되지 않은 문자열로 enum 값을 지정하십시오. 예 : 제공 :
public enum Foo
{
Value1,
Value2
}
public class MainWindowVm
{
public string this[Foo foo]
{
get { return Enum.GetName(typeof(Foo), foo); }
}
}
그래서 같은 열거 값을 지정
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
<local:MainWindowVm/>
</Window.DataContext>
<Grid>
<TextBlock Text="{Binding Path=[Value1]}"/>
</Grid>
</Window>
X : 정적 태그 확장은 XAML 파서가 지원이 내장되어 있기 때문에 그 지원하는 값으로 제공된 문자열을 매핑 할 필요가 없습니다 타겟 열거
예, 그게 내가 말하고자하는 것입니다. 전환 사용은 대체 옵션입니다. 고맙습니다. – Yegor