【发布时间】:2013-08-21 10:50:02
【问题描述】:
我在一个选项卡中有一个组合框,我可以用鼠标改变它的大小、倾斜和旋转。但是,当我想移动它时,我不被允许。要更改组合框的位置,我必须在边距字段中手动输入坐标,这真的很烦人。为什么我不能简单地用鼠标拖动它来移动它?
更新
这实际上只发生在第二个选项卡中。在第一个选项卡中,我可以像预期的那样移动控件。 因此,我在我的 xaml 文件中剪切并粘贴了选项卡部分以更改选项卡顺序。现在,我可以在第一个选项卡(前第二个选项卡)中移动控件,而不能在第二个选项卡中移动控件。
对我来说,这听起来像是 WPF 设计器的错误...
更新 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>
改变tab顺序后,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>
【问题讨论】:
-
对我来说很好。如果可以,请显示您拥有的显示此问题的 xaml 代码。
标签: wpf visual-studio-2012 controls designer