<i id='93I3b'><tr id='93I3b'><dt id='93I3b'><q id='93I3b'><span id='93I3b'><b id='93I3b'><form id='93I3b'><ins id='93I3b'></ins><ul id='93I3b'></ul><sub id='93I3b'></sub></form><legend id='93I3b'></legend><bdo id='93I3b'><pre id='93I3b'><center id='93I3b'></center></pre></bdo></b><th id='93I3b'></th></span></q></dt></tr></i><div id='93I3b'><tfoot id='93I3b'></tfoot><dl id='93I3b'><fieldset id='93I3b'></fieldset></dl></div>
    1. <legend id='93I3b'><style id='93I3b'><dir id='93I3b'><q id='93I3b'></q></dir></style></legend>

        <bdo id='93I3b'></bdo><ul id='93I3b'></ul>

      <small id='93I3b'></small><noframes id='93I3b'>

      <tfoot id='93I3b'></tfoot>
      1. 重新排序 WPF TabControl 中的选项卡

        时间:2023-08-25
      2. <legend id='oIoIR'><style id='oIoIR'><dir id='oIoIR'><q id='oIoIR'></q></dir></style></legend>

        <small id='oIoIR'></small><noframes id='oIoIR'>

            1. <i id='oIoIR'><tr id='oIoIR'><dt id='oIoIR'><q id='oIoIR'><span id='oIoIR'><b id='oIoIR'><form id='oIoIR'><ins id='oIoIR'></ins><ul id='oIoIR'></ul><sub id='oIoIR'></sub></form><legend id='oIoIR'></legend><bdo id='oIoIR'><pre id='oIoIR'><center id='oIoIR'></center></pre></bdo></b><th id='oIoIR'></th></span></q></dt></tr></i><div id='oIoIR'><tfoot id='oIoIR'></tfoot><dl id='oIoIR'><fieldset id='oIoIR'></fieldset></dl></div>
              • <tfoot id='oIoIR'></tfoot>

                  <tbody id='oIoIR'></tbody>
                  <bdo id='oIoIR'></bdo><ul id='oIoIR'></ul>

                • 本文介绍了重新排序 WPF TabControl 中的选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  是否有一种简单的方法可以自定义 WPF TabControl 以便它支持 TabItem 拖放 - 类似于 IE 和 firefox 所做的.

                  解决方案

                  您可以使用或开始使用

                  Is there an easy way to customize the WPF TabControl so that it supports TabItem drag and drop - similar to what IE and firefox do.

                  解决方案

                  You could use or get started with Bea Stollnitz's existing helpers for Dragging and Dropping in an ItemsControl. It does have some limitations as she mentions, but it's a great place to start, and probably will work as is for most all of the functionality you will require.

                  After importing her DragDropHelper and Adorner classes, it's very simple to use them with the TabControl (Since it is a descendant of ItemsControl).

                  Setting a simple drag template, and the properties on the TabControl are all we need. Since the solution is set up to handle dragging of data bound items, if your tabs are statically declared in XAML instead of using the TabControl.ItemsSource then you can just bind their DataContext to themselves.

                  <Window x:Class="Samples.Window1"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:dd="clr-namespace:DragDropListBox"
                      Title="Dragging TabItems"
                      Height="300"
                      Width="300">
                  
                  <Window.Resources>
                      <DataTemplate x:Key="Local_TabItemDragTemplate">
                          <Border CornerRadius="5"
                                  BorderBrush="Black"
                                  BorderThickness="2"
                                  Background="DodgerBlue">
                              <TextBlock Margin="5"
                                         Text="{Binding Path=Header}" />
                          </Border>
                      </DataTemplate>
                  </Window.Resources>
                  
                  <StackPanel>
                      <TabControl dd:DragDropHelper.IsDragSource="true"
                                  dd:DragDropHelper.IsDropTarget="true"
                                  dd:DragDropHelper.DragDropTemplate="{StaticResource Local_TabItemDragTemplate}">
                          <TabControl.ItemContainerStyle>
                              <Style TargetType="{x:Type TabItem}">
                                  <Setter Property="DataContext"
                                          Value="{Binding RelativeSource={RelativeSource Self}}" />
                              </Style>
                          </TabControl.ItemContainerStyle>
                          <TabItem Header="Tab 1" />
                          <TabItem Header="Tab 2" />
                          <TabItem Header="Tab 3" />
                          <TabItem Header="Tab 4" />
                      </TabControl>
                      <TabControl dd:DragDropHelper.IsDragSource="true"
                                  dd:DragDropHelper.IsDropTarget="true"
                                  dd:DragDropHelper.DragDropTemplate="{StaticResource Local_TabItemDragTemplate}">
                          <TabControl.ItemContainerStyle>
                              <Style TargetType="{x:Type TabItem}">
                                  <Setter Property="DataContext"
                                          Value="{Binding RelativeSource={RelativeSource Self}}" />
                              </Style>
                          </TabControl.ItemContainerStyle>
                          <TabItem Header="Tab 5" />
                          <TabItem Header="Tab 6" />
                          <TabItem Header="Tab 7" />
                          <TabItem Header="Tab 8" />
                      </TabControl>
                  </StackPanel>
                  

                  这篇关于重新排序 WPF TabControl 中的选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:接收从网页拖动到 WPF 窗口的图像 下一篇:C# 从列表框中拖放

                  相关文章

                  最新文章

                    • <bdo id='ugfpq'></bdo><ul id='ugfpq'></ul>
                  1. <i id='ugfpq'><tr id='ugfpq'><dt id='ugfpq'><q id='ugfpq'><span id='ugfpq'><b id='ugfpq'><form id='ugfpq'><ins id='ugfpq'></ins><ul id='ugfpq'></ul><sub id='ugfpq'></sub></form><legend id='ugfpq'></legend><bdo id='ugfpq'><pre id='ugfpq'><center id='ugfpq'></center></pre></bdo></b><th id='ugfpq'></th></span></q></dt></tr></i><div id='ugfpq'><tfoot id='ugfpq'></tfoot><dl id='ugfpq'><fieldset id='ugfpq'></fieldset></dl></div>

                    <small id='ugfpq'></small><noframes id='ugfpq'>

                    <legend id='ugfpq'><style id='ugfpq'><dir id='ugfpq'><q id='ugfpq'></q></dir></style></legend><tfoot id='ugfpq'></tfoot>