When I need to binding a enum to RadioButton , Reference the How to bind RadioButtons to an enum? question's better answer.
enum code:
public enum SelectionMode
{
FixedMode = 0,
FreeMode = 1
}
/// <summary>
/// MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
xaml code:
<RadioButton Content="FreeMode" IsChecked="{Binding ChannelSelectionMode, Converter={StaticResource enumToBooleanConverter}, ConverterParameter={x:Static local:SelectionMode.FreeMode}}" ></RadioButton>
I've got this exception :
xaml exception: namaspace not found the SelectionMode, the enum SelectionMode in the namespace, x:Type Local:SelectionMode can be work.
I tried this way:
- move enum
SelectionMode
toViewmodels
's namespace. - move enum
SelectionMode
into oneViewmodel
class.
but all not work. Please give me some sugguestion, I am crazy.