Click here to Skip to main content
15,907,497 members
Home / Discussions / C#
   

C#

 
GeneralRe: Count same values in single array Pin
buchstaben15-Mar-08 5:44
buchstaben15-Mar-08 5:44 
GeneralRe: Count same values in single array Pin
pmarfleet15-Mar-08 6:37
pmarfleet15-Mar-08 6:37 
GeneralRe: Count same values in single array Pin
buchstaben15-Mar-08 8:52
buchstaben15-Mar-08 8:52 
GeneralRe: Count same values in single array Pin
pmarfleet15-Mar-08 6:21
pmarfleet15-Mar-08 6:21 
GeneralRe: Count same values in single array Pin
Cptkli15-Mar-08 7:17
Cptkli15-Mar-08 7:17 
GeneralRe: Count same values in single array Pin
Luc Pattyn15-Mar-08 9:06
sitebuilderLuc Pattyn15-Mar-08 9:06 
GeneralEvent Problem Pin
Jammer15-Mar-08 1:09
Jammer15-Mar-08 1:09 
GeneralRe: Event Problem Pin
Luc Pattyn15-Mar-08 1:23
sitebuilderLuc Pattyn15-Mar-08 1:23 
GeneralRe: Event Problem Pin
Jammer15-Mar-08 1:50
Jammer15-Mar-08 1:50 
GeneralRe: Event Problem Pin
DaveyM6915-Mar-08 2:38
professionalDaveyM6915-Mar-08 2:38 
GeneralRe: Event Problem Pin
Jammer15-Mar-08 3:00
Jammer15-Mar-08 3:00 
GeneralRe: Event Problem Pin
Jammer15-Mar-08 2:39
Jammer15-Mar-08 2:39 
GeneralRe: Event Problem Pin
DaveyM6915-Mar-08 2:45
professionalDaveyM6915-Mar-08 2:45 
GeneralRe: Event Problem Pin
Jammer15-Mar-08 3:05
Jammer15-Mar-08 3:05 
GeneralRe: Event Problem Pin
DaveyM6915-Mar-08 3:26
professionalDaveyM6915-Mar-08 3:26 
GeneralRe: Event Problem Pin
Jammer15-Mar-08 3:41
Jammer15-Mar-08 3:41 
GeneralRe: Event Problem Pin
DaveyM6915-Mar-08 4:10
professionalDaveyM6915-Mar-08 4:10 
Done a very simple example that you may be able to learn from so you can fix your problem.

I created a default WPF app (WpfApplication1) then created a user control (UserControl1).
In UserControl1 (in the namespace but outside the class) I created a delegate
public delegate void UserControlDelegate(object sender, EventArgs e);
and (inside the class) an event public event UserControlDelegate UserControlEvent;
then added a public property that when set raises the event with this:
if (null != UserControlEvent)
      UserControlEvent(this, EventArgs.Empty);


Then I added this to Window1.xaml xmlns:UserControlNamespace="clr-namespace:WpfApplication1"
and then in the Grid block
<UserControlNamespace:UserControl1 x:Name="MyUsercontrol" Width="100" Height="100"></UserControlNamespace:UserControl1>
then changed the Window1 class in Window1.xaml.cs to
public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            MyUsercontrol.UserControlEvent += new UserControlDelegate(MyUsercontrol_UserControlEvent);
        }

        void MyUsercontrol_UserControlEvent(object sender, EventArgs e)
        {
            Console.WriteLine("Event Raised");
        }
    }


This is not exactly how I'd do it in production (I'd use protected virtual methods to raise the event etc, etc... ) but it should get you started.

Dave

GeneralRe: Event Problem Pin
Jammer15-Mar-08 5:06
Jammer15-Mar-08 5:06 
GeneralRe: Event Problem Pin
Jammer15-Mar-08 5:15
Jammer15-Mar-08 5:15 
GeneralRe: Event Problem Pin
DaveyM6915-Mar-08 5:24
professionalDaveyM6915-Mar-08 5:24 
GeneralRe: Event Problem Pin
Luc Pattyn15-Mar-08 3:51
sitebuilderLuc Pattyn15-Mar-08 3:51 
GeneralRe: Event Problem Pin
Jammer15-Mar-08 4:00
Jammer15-Mar-08 4:00 
QuestionHow can I take data from a datagrid and display it in an Excel Spreadsheet? Pin
Walaza15-Mar-08 0:31
Walaza15-Mar-08 0:31 
AnswerRe: How can I take data from a datagrid and display it in an Excel Spreadsheet? Pin
buchstaben15-Mar-08 5:47
buchstaben15-Mar-08 5:47 
GeneralRe: How can I take data from a datagrid and display it in an Excel Spreadsheet? Pin
Walaza16-Mar-08 6:23
Walaza16-Mar-08 6:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.