Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
swdev:dotnet:wpf:user_controls_and_intercommunication [2011/01/18 16:36] smayr |
swdev:dotnet:wpf:user_controls_and_intercommunication [2011/05/25 09:48] (current) smayr |
||
---|---|---|---|
Line 10: | Line 10: | ||
< | < | ||
< | < | ||
- | < | + | < |
</ | </ | ||
</ | </ | ||
</ | </ | ||
- | Or programmatically (in C#): | + | Attach menu event programmatically (in C#): |
<code csharp> | <code csharp> | ||
using System; | using System; | ||
Line 42: | Line 42: | ||
InitializeComponent(); | InitializeComponent(); | ||
| | ||
+ | // Attach menu event handler | ||
popupmnu1.MenuItemSelected += new RoutedEventHandler(ucPopupMnu_MenuItemSelected); | popupmnu1.MenuItemSelected += new RoutedEventHandler(ucPopupMnu_MenuItemSelected); | ||
} | } | ||
Line 62: | Line 63: | ||
</ | </ | ||
- | If defined with XAML, then the '' | + | If the event is defined with XAML ('' |
+ | <code xml> | ||
+ | <Window x: | ||
+ | xmlns=" | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | Title=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | The code-behind looks like ('' | ||
<code csharp> | <code csharp> | ||
using System; | using System; | ||
Line 88: | Line 103: | ||
{ | { | ||
InitializeComponent(); | InitializeComponent(); | ||
+ | | ||
+ | // This next line should not be present, since XAML will add it automatically in InitializeComponent() | ||
+ | // | ||
} | } | ||
Line 301: | Line 319: | ||
== Resources == | == Resources == | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// |