'宣言 Public Shared Function GetSortOrder( _ ByVal d As DependencyObject _ ) As Integer
public static int GetSortOrder( DependencyObject d )
すべての要素にソート順序が指定されているわけではない場合、子は元の順序のままになります。ソート順序がすべてではなく一部の要素に指定されている場合、値が指定され、元のソート順序に基づいてソートされる要素の後ろにソート順序が指定されることなく、すべての要素が表示されます。
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);