views:

14

answers:

0

Hi all: C# vs2010 XAML

How can I move the code behind to the xaml window code? and also like to bind them to a property defined in a persistent class as
Public class MyClass { public Myenum RadioBtns {get; set;}

Thanks

I have 4 radio buttons on a XAML window

on code behind i have

    private void rdo1_Click(object sender, RoutedEventArgs e)
    {            
        if (rdoICD1.IsChecked == true) datasource.Type = Myenum.One;
    }

    private void rdo2_Click(object sender, RoutedEventArgs e)
    {            
        if (rdo2.IsChecked == true) datasource.MyType = Myenum.two;
    }

    private void rdo3_Click(object sender, RoutedEventArgs e)
     {
         if (rdo3.IsChecked == true) datasource.MyType = Myenum.three;  
     }

    private void rdo4_Click(object sender, RoutedEventArgs e)
    {
        if (rdo4.IsChecked == true) datasource.MyType = Myenum.four
    }

the enum class

    Public enum Myenum
    {
        one,
        two,
        three,
        four
    }

the datasource is from this class public class Test { public MyEnum MyType {get;set}

                  (more properties)      

Thanks