Может как это?
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<Border Background="Red" Height="12" VerticalAlignment="Top" MouseEnter="StackPanel_MouseEnter" MouseLeave="StackPanel_MouseLeave"></Border>
</Grid>
C # код позади
private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
{
Border sp = sender as Border;
DoubleAnimation db = new DoubleAnimation();
//db.From = 12;
db.To = 150;
db.Duration = TimeSpan.FromSeconds(0.5);
db.AutoReverse = false;
db.RepeatBehavior = new RepeatBehavior(1);
sp.BeginAnimation(StackPanel.HeightProperty, db);
}
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
{
Border sp = sender as Border;
DoubleAnimation db = new DoubleAnimation();
//db.From = 12;
db.To = 12;
db.Duration = TimeSpan.FromSeconds(0.5);
db.AutoReverse = false;
db.RepeatBehavior = new RepeatBehavior(1);
sp.BeginAnimation(StackPanel.HeightProperty, db);
}
}
Вы можете использовать любой элемент управления, такой как сетка, стек, док, граница ...