체크 아웃 다음 작업 예. 그것은 정확히 당신의 시나리오는 아니지만 꽤 가까운 것입니다. 열쇠는 'Child'속성을 null로 설정하는 것입니다. TextBox를 위쪽 테두리에서 아래쪽 테두리로 이동합니다.
<Window x:Class="SO.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Button Grid.Row="0" Click="Move_Click">Move</Button>
<Border x:Name="topBorder" Grid.Row="1">
<TextBlock x:Name="ctrl">Some Text Block</TextBlock>
</Border>
<Border x:Name="bottomBorder" Grid.Row="2"/>
</Grid>
</Window>
뒤에 코드 :
using System.Windows;
namespace SO
{
public partial class MainWindow :Window
{
public MainWindow()
{
InitializeComponent();
}
private void Move_Click(object sender, RoutedEventArgs e)
{
this.topBorder.Child = null;
this.bottomBorder.Child = this.ctrl;
}
}
}
출처
2012-02-15 09:35:49
Uri
흠, 내 방법의 모든 것을 대신 이벤트 hadler 콘텐츠 설정을 가하고 후 잘 작동합니다. 감사! – noaRAVE