je travail sur un projet silverlight
j'ai de page : home.cs et MainPage.cs
le probleme c que je veux apartire de le page home je peux controler des boutons sur le MainPage , donc j'utilise les evenement
donc c qlq 1 peut me montrer un exemple d'un evenement simple envoyer par home.cs intercipter par MainPage.cs
MON HOME.CS
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 public partial class Home : Page { /// <summary> /// Creates a new <see cref="Home"/> instance. /// </summary> public Home() { InitializeComponent(); this.Title = ApplicationStrings.HomePageTitle; } /// <summary> /// Executes when the user navigates to this page. /// </summary> protected override void OnNavigatedTo(NavigationEventArgs e) { } }
MON MainPage.cs
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 public partial class MainPage : UserControl { /// <summary> /// Creates a new <see cref="MainPage"/> instance. /// </summary> /// public MainPage() { InitializeComponent(); this.loginContainer.Child = new LoginStatus(); } /// <summary> /// After the Frame navigates, ensure the <see cref="HyperlinkButton"/> representing the current page is selected /// </summary> private void ContentFrame_Navigated(object sender, NavigationEventArgs e) { foreach (UIElement child in LinksStackPanel.Children) { HyperlinkButton hb = child as HyperlinkButton; if (hb != null && hb.NavigateUri != null) { if (hb.NavigateUri.ToString().Equals(e.Uri.ToString())) { VisualStateManager.GoToState(hb, "ActiveLink", true); } else { VisualStateManager.GoToState(hb, "InactiveLink", true); } } } } /// <summary> /// If an error occurs during navigation, show an error window /// </summary> private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) { e.Handled = true; ErrorWindow.CreateNew(e.Exception); } public void RecoitAlerte(object sender, EventArgs e) { xxArgs info = e as xxArgs; } }
Partager