Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么可以';我不能在WPF设计器中的选项卡中移动控件吗?_Wpf_Visual Studio 2012_Controls_Designer - Fatal编程技术网

为什么可以';我不能在WPF设计器中的选项卡中移动控件吗?

为什么可以';我不能在WPF设计器中的选项卡中移动控件吗?,wpf,visual-studio-2012,controls,designer,Wpf,Visual Studio 2012,Controls,Designer,我有一个标签内的组合框,我可以改变它的大小,倾斜和旋转鼠标。然而,当我想移动它时,我是不允许的。要更改组合框的位置,我必须在边距字段中手动输入坐标,这真的很烦人。为什么我不能用鼠标拖动它来移动它 更新 这实际上只在第二个选项卡中发生。在第一个选项卡中,我可以像预期的那样移动控件。 因此,我在xaml文件中剪切并粘贴了选项卡部分,以更改选项卡顺序。现在,我可以在第一个选项卡(以前的第二个选项卡)中移动控件,而不能在第二个选项卡中移动控件 听起来像是WPF设计师的bug 更新2 这是一个简单的测试用

我有一个标签内的组合框,我可以改变它的大小,倾斜和旋转鼠标。然而,当我想移动它时,我是不允许的。要更改组合框的位置,我必须在边距字段中手动输入坐标,这真的很烦人。为什么我不能用鼠标拖动它来移动它

更新

这实际上只在第二个选项卡中发生。在第一个选项卡中,我可以像预期的那样移动控件。 因此,我在xaml文件中剪切并粘贴了选项卡部分,以更改选项卡顺序。现在,我可以在第一个选项卡(以前的第二个选项卡)中移动控件,而不能在第二个选项卡中移动控件

听起来像是WPF设计师的bug

更新2

这是一个简单的测试用例。无法移动第二个选项卡中的TestComboBox

<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="718" Width="728" Background="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}">
    <TabControl HorizontalAlignment="Left" VerticalAlignment="Top">
        <TabItem Header="TabItem">
            <Grid Margin="0,10,0,4" Height="639" Width="708">
            </Grid>
        </TabItem>
        <TabItem Header="TabItem" Height="23">

            <Grid Margin="0,10,0,4" Height="639" Width="708">
                <ComboBox x:Name="TestComboBox" HorizontalAlignment="Left" Margin="84,10,0,0" Width="217" VerticalAlignment="Top" Height="22"/>
            </Grid>

        </TabItem>
    </TabControl>
</Window>

更改选项卡顺序后,可以移动TestComboBox:

<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="718" Width="728" Background="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}">
    <TabControl HorizontalAlignment="Left" VerticalAlignment="Top">
        <TabItem Header="TabItem" Height="23">

            <Grid Margin="0,10,0,4" Height="639" Width="708">
                <ComboBox x:Name="TestComboBox" HorizontalAlignment="Left" Margin="84,10,0,0" Width="217" VerticalAlignment="Top" Height="22"/>
            </Grid>

        </TabItem>            
        <TabItem Header="TabItem">
            <Grid Margin="0,10,0,4" Height="639" Width="708">
            </Grid>
        </TabItem>
    </TabControl>
</Window>

我刚刚尝试将
TabControl
添加到新的WPF应用程序中。我添加了两个
TabItem
控件,每个控件中都有一个
组合框。起初,VisualStudio允许我移动第一个选项卡中的
组合框,但不允许移动第二个选项卡

在我移动第二个选项卡中的
组合框后,当我松开鼠标按钮时,它会跳回原来的位置。仔细检查,这是因为在第一个
选项卡项中有一个
网格,但在第二个选项卡项中没有。。。也许你也有类似的问题


然而,在测试了您刚才添加的代码之后,我恐怕不能说我没有和您一样的问题。也许您应该重新启动Visual Studio,甚至您的计算机?

在使用WPF时,我也有同样的问题,但我这样做是为了“绕过”它

只需在将要处理的网格之前对网格进行注释


我知道在处理大型项目时这样做很痛苦,但这是我发现的唯一方法。

我也有同样的问题。通过将TabControl放置在网格中解决了此问题-请参见下面的代码

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="718" Width="728" Background="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}">
<Grid>    
<TabControl HorizontalAlignment="Left" VerticalAlignment="Top">
        <TabItem Header="TabItem" Height="23">

        <Grid Margin="0,10,0,4" Height="639" Width="708">
            <ComboBox x:Name="TestComboBox" HorizontalAlignment="Left" Margin="84,10,0,0" Width="217" VerticalAlignment="Top" Height="22"/>
        </Grid>

        </TabItem>            
        <TabItem Header="TabItem">
        <Grid Margin="0,10,0,4" Height="639" Width="708">
          <ComboBox x:Name="TestComboBox2" HorizontalAlignment="Left" Margin="84,10,0,0" Width="217"       VerticalAlignment="Top" Height="22"/>
            </Grid>
        </TabItem>
    </TabControl>
</Window>

对我来说很好。如果可以的话,请显示您得到的显示此问题的xaml代码。您是否缺少
之前的