我有一个列表视图,在列表视图中,您可以单击一个订单号,它会弹出一个网格来编辑有关订单的详细信息!
它弹出的这个网格是可以通过这个代码拖动的(tt 是一个 translatetransform):
Point m_start;
Vector m_startOffset;
private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
{
m_start = e.GetPosition(mainWindow);
m_startOffset = new Vector(tt.X, tt.Y);
gridShippingInstructionsForOrder.CaptureMouse();
}
private void Grid_MouseMove(object sender, MouseEventArgs e)
{
if (gridShippingInstructionsForOrder.IsMouseCaptured)
{
Vector offset = Point.Subtract(e.GetPosition(mainWindow), m_start);
tt.X = m_startOffset.X + offset.X;
tt.Y = m_startOffset.Y + offset.Y;
}
}
private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
{
gridShippingInstructionsForOrder.ReleaseMouseCapture();
}
现在的问题是,当您单击屏幕底部的订单时,它会弹出屏幕一半的网格,而当您将其拖到屏幕上时,它会被切成两半!(即使将其拖回屏幕中间)