需要使用Canvas而不是Grid

时间:2014-09-30 09:17:09

标签: c# wpf wpf-controls

我被要求修复一个错误,其中宽度框比它从屏幕边缘掉落应该更长,但我不允许从画布更改它。从其他图像中可以看出,其余的布局很好,我只需要将宽度文本框放小一点。

在Visual Studio中的我的布局视图中,它显示了正确的大小,但在屏幕上它正在拉伸它?

enter image description here

<Canvas Margin="0,0,-249.6,0">
    <ListView Canvas.Left="12" Canvas.Top="48" Height="183" Name="listView1"
            Width="453" 
            SelectionMode="Single">
        <ListView.View>
            <GridView>
                <GridViewColumn Header="Order" Width="100" 
                       DisplayMemberBinding="{Binding Path=CustomColumnsOrder}"></GridViewColumn>
                <GridViewColumn Header="Display Name" Width="290" 
                          DisplayMemberBinding="{Binding Path=CustomColumnsDisplayName}"></GridViewColumn>
                <GridViewColumn Header="Width" Width="50" 
                        DisplayMemberBinding="{Binding Path=CustomColumnsWidth}"></GridViewColumn>

            </GridView>
        </ListView.View>
    </ListView>
    <Button Name="moveUpButton" Canvas.Left="472.4" Click="MoveUp"  Canvas.Top="50" Content="Move Up" 
            Height="22" Width="74"  />

    <Button Name="moveDownButton" Canvas.Left="472.4" Click="MoveDown" Canvas.Top="80" Content="Move Down" 
            Height="22" Width="74"  />


    <Button Name="deleteButton" Canvas.Left="472.4" IsEnabled="{Binding ElementName=columnsList, Path=SelectedItems.Count}" Click="RemoveColumn"   Canvas.Top="110" Content="Delete" 
            Height="22" Width="74"  />

    <Button Name="addButton" Click="AddColumn" Canvas.Left="472.4" Canvas.Top="140" Content="Add Item" 
            Height="22" Width="74" />

    <Label Content="Name:" Canvas.Left="12" Canvas.Top="250" />

    <TextBox   Name="txtDsiplayName" Text="{Binding Path=CustomColumnsDisplayName, Mode=TwoWay}" Canvas.Left="12" Canvas.Top="280" Height="23"   
            Width="452"  >

    </TextBox>

    <Label Content="Width:"   Canvas.Left="470" Canvas.Top="250" />
    <TextBox  Name="txtWdith"  Text="{Binding Path=CustomColumnsWidth, Mode=TwoWay}"  Canvas.Left="470"  Canvas.Top="280" Height="23"  
            Width="52.8" 
             />

</Canvas>

0 个答案:

没有答案