'宣言 Public Shared Sub SetSortOrder( _ ByVal d As DependencyObject, _ ByVal value As Integer _ )
public static void SetSortOrder( DependencyObject d, int value )
Dim toolHWrapPanel As New ToolHorizontalWrapPanel() toolHWrapPanel.MinRows = 1 toolHWrapPanel.MaxRows = 2 Dim button1 As New ButtonTool() button1.Caption = "Tool Button 1 ... " Dim button2 As New ButtonTool() button2.Caption = "Tool Button 2 ... " Dim button3 As New ButtonTool() button3.Caption = "Tool Button 3 ... " Dim button4 As New ButtonTool() button4.Caption = "Tool Button 4 ... " Dim button5 As New ButtonTool() button5.Caption = "Tool Button 5 ... " toolHWrapPanel.Children.Add(button1) toolHWrapPanel.Children.Add(button2) toolHWrapPanel.Children.Add(button3) toolHWrapPanel.Children.Add(button4) toolHWrapPanel.Children.Add(button5) ToolHorizontalWrapPanel.SetSortOrder(button1, 10) ToolHorizontalWrapPanel.SetSortOrder(button2, 20) ToolHorizontalWrapPanel.SetSortOrder(button3, 30) Dim sortOrder As Integer = ToolHorizontalWrapPanel.GetSortOrder(button3) ToolHorizontalWrapPanel.SetSortOrder(button4, sortOrder - 1) ToolHorizontalWrapPanel.SetSortOrder(button5, sortOrder + 1)
ToolHorizontalWrapPanel toolHWrapPanel = new ToolHorizontalWrapPanel(); toolHWrapPanel.MinRows = 1; toolHWrapPanel.MaxRows = 2; ButtonTool button1 = new ButtonTool(); button1.Caption = "Tool Button 1 ... "; ButtonTool button2 = new ButtonTool(); button2.Caption = "Tool Button 2 ... "; ButtonTool button3 = new ButtonTool(); button3.Caption = "Tool Button 3 ... "; ButtonTool button4 = new ButtonTool(); button4.Caption = "Tool Button 4 ... "; ButtonTool button5 = new ButtonTool(); button5.Caption = "Tool Button 5 ... "; toolHWrapPanel.Children.Add(button1); toolHWrapPanel.Children.Add(button2); toolHWrapPanel.Children.Add(button3); toolHWrapPanel.Children.Add(button4); toolHWrapPanel.Children.Add(button5); ToolHorizontalWrapPanel.SetSortOrder(button1, 10); ToolHorizontalWrapPanel.SetSortOrder(button2, 20); ToolHorizontalWrapPanel.SetSortOrder(button3, 30); int sortOrder = ToolHorizontalWrapPanel.GetSortOrder(button3); ToolHorizontalWrapPanel.SetSortOrder(button4, sortOrder-1); ToolHorizontalWrapPanel.SetSortOrder(button5, sortOrder + 1);