你好,这个效果应该可以在上方动态的控制一个自定义控件的显示和隐藏。
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="grid" Visibility="Collapsed">
<Rectangle Canvas.ZIndex="-20" Height="30" Width="auto" Fill="Green" />
<TextBlock Canvas.ZIndex="100" Text="请输入用户名" Foreground="White" HorizontalAlignment="Stretch" Height="30" ></TextBlock>
</Grid>
<Button Content="Button" Grid.Row="1" Height="72" HorizontalAlignment="Left" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click_1" />
</Grid>
private void button1_Click_1(object sender, RoutedEventArgs e)
{
grid.Visibility = System.Windows.Visibility.Visible;
}