2012-07-27 66 views
0

對於日曆應用程序(Silverlight WP7.5),我使用wrappanel來包含日期(帶Button的Border作爲子項)。現在我想在邊框內添加另一個按鈕。所以每一天都會有數量和額外的信息/圖形。剛注意到Border只能包含1個孩子。我該如何處理它?WP7 Silverlight:如何將兩個Button添加到WrapPanel的邊框

Border border = new Border(); 
Button btn = new Button(); 
border.Child = btn; 
//Button btn_notification = new Button(); 
// how to add the btn_notification???? 
CalendarWrapPanel.Children.Add(border); 

非常感謝您!

回答

1

只需在您的邊框內添加另一個Container(Grid,StackPanel,...)。 本示例使用StackPanel對其進行了展示:

Border border = new Border(); 
Button btn = new Button(); 
Button btn_notification = new Button(); 
StackPanel panel = new StackPanel(); 
panel.Children.Add(btn); 
panel.Children.Add(btn_notification); 
border.Child = panel; 
CalendarWrapPanel.Children.Add(border); 
+0

謝謝!這工作。 – thsieh 2012-07-28 05:15:06