Usercontrol Events using radbutton..

2 posts, 0 answers
  1. gautham
    gautham avatar
    5 posts
    Member since:
    Dec 2010

    Posted 02 Dec 2010 Link to this post

    I am using a user control which has 2 labels and 1 button. And this user control I am displaying in my main page using listbox.Itemtemplet  which makes my user control to show number of time my iteamsource contains ....in my case usercontrol is created for 6 times

    But thing here is my button in user control should have events as many times as it loads in my listbox so that I can write some code in codebehind... I think there should be something close to this....
     public eventHandler  buttonclick;
            public  usercontrol()
            {
                
                InitializeComponent();
    testButton.Click +=(s,e) =>
              {
             if(buttonclick != null )
              buttonclick(s,e);
             };


    please help me I dint find any solution...
  2. gautham
    gautham avatar
    5 posts
    Member since:
    Dec 2010

    Posted 03 Dec 2010 Link to this post

    here is my saviour I atlast found my solution and now I remember this was the dumb question

     

     

    public Usercontrol()

     

    {

    InitializeComponent();

    ButtonExport.Click +=

     

    new RoutedEventHandler(ButtonExport_Click);

     

    }

     

     

    void ButtonExport_Click(object sender, RoutedEventArgs e)

     

    {

     

     

    MessageBox.Show(TextHeader.Text);

     

    }

  3. DevCraft banner
Back to Top