61 { |
61 { |
62 ItemButton.ContactDown += ButtonMenu_ContactDown; |
62 ItemButton.ContactDown += ButtonMenu_ContactDown; |
63 ItemButton.Click += ButtonMenu_ContactDown; |
63 ItemButton.Click += ButtonMenu_ContactDown; |
64 MItem.Children.Add(ItemButton); |
64 MItem.Children.Add(ItemButton); |
65 StackPanel Temp = new StackPanel(); |
65 StackPanel Temp = new StackPanel(); |
66 Temp.Margin = new Thickness(15,0,0,0); |
|
67 foreach (Item elt in item.Items) |
66 foreach (Item elt in item.Items) |
68 try |
67 try |
69 { |
68 { |
70 Temp.Children.Add(CreateMenuItem(elt)); |
69 Temp.Children.Add(CreateMenuItem(elt)); |
71 } |
70 } |
72 catch (Exception) { } |
71 catch (Exception) { } |
73 Temp.Name = ItemButton.Content + "Panel"; |
72 Temp.Name = ItemButton.Content.ToString().Replace(' ', '_') + "Panel"; |
74 Temp.Visibility = Visibility.Collapsed; |
73 Temp.Visibility = Visibility.Collapsed; |
75 MItem.Children.Add(Temp); |
74 MItem.Children.Add(Temp); |
76 } |
75 } |
77 else |
76 else |
78 { |
77 { |
79 ItemButton.Action = item.Action; |
78 ItemButton.Action = item.Action; |
80 //ItemButton.ApplyTemplate(); |
|
81 //ItemButton.ContactDown += GenerateAction; |
|
82 //ItemButton.Click += GenerateAction; |
|
83 MItem.Children.Add(ItemButton); |
79 MItem.Children.Add(ItemButton); |
84 } |
80 } |
85 return MItem; |
81 return MItem; |
86 } |
82 } |
87 catch (Exception ex) |
83 catch (Exception ex) |
88 { |
84 { |
89 throw ex; |
85 throw ex; |
90 } |
86 } |
91 } |
87 } |
92 |
|
93 /* |
|
94 * Déplacé dans le CustomSurfaceButton |
|
95 |
|
96 private void GenerateAction(Object sender, RoutedEventArgs Event) |
|
97 { |
|
98 try |
|
99 { |
|
100 ActionFactory.ActionGenerator AG = (new ActionFactory.ActionFactory()).GetGenerator(); |
|
101 FingersDance.Actions.ActionBase action = AG.GetAction("Action" + ((Microsoft.Surface.Presentation.Controls.SurfaceButton)sender).Content, null); |
|
102 if (action != null) |
|
103 { |
|
104 //action.Execute(); |
|
105 //this.debug.addToList(action.GetType().ToString()); |
|
106 } |
|
107 } |
|
108 catch (Exception e) { } |
|
109 } |
|
110 |
|
111 * |
|
112 */ |
|
113 |
88 |
114 private void ButtonMenu_ContactDown(object sender, RoutedEventArgs e) |
89 private void ButtonMenu_ContactDown(object sender, RoutedEventArgs e) |
115 { |
90 { |
116 foreach (UIElement Child in ((Panel)((CustomSurfaceButton)sender).Parent).Children) |
91 foreach (UIElement Child in ((Panel)((CustomSurfaceButton)sender).Parent).Children) |
117 try |
92 try |
118 { |
93 { |
119 if (((StackPanel)Child).Name.Equals(((Microsoft.Surface.Presentation.Controls.SurfaceButton)sender).Content + "Panel")) |
94 if (((StackPanel)Child).Name.Equals(((Microsoft.Surface.Presentation.Controls.SurfaceButton)sender).Content.ToString().Replace(' ', '_') + "Panel")) |
120 { |
95 { |
121 if (((StackPanel)Child).Visibility == Visibility.Collapsed) |
96 if (((StackPanel)Child).Visibility == Visibility.Collapsed) |
122 { |
97 { |
123 ((StackPanel)Child).Visibility = Visibility.Visible; |
98 ((StackPanel)Child).Visibility = Visibility.Visible; |
124 } |
99 } |