This is a migrated thread and some comments may be shown as answers.

Usercontrol Events using radbutton..

1 Answer 42 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
gautham
Top achievements
Rank 1
gautham asked on 03 Dec 2010, 03:55 AM
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...

1 Answer, 1 is accepted

Sort by
0
gautham
Top achievements
Rank 1
answered on 03 Dec 2010, 03:03 PM
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);

 

}

Tags
Buttons
Asked by
gautham
Top achievements
Rank 1
Answers by
gautham
Top achievements
Rank 1
Share this question
or