0

I have a view in my .NET4 WPF application that consists of a TextBlock, a button, and another TextBlock arranged vertically. They are on three different rows of a Grid. When the user clicks the button, I'm hiding (collapsing) my button and displaying output to the lower TextBlock. When processing is finished, a different button is then made visible in the same place as the first.

This ends up causing the lower TextBlock to jump up slightly to take up the space once reserved for the button before it collapses, then jump back down to make room for the new button.

My solution now is to disable the button instead of collapsing it.

I've used a Strut before when working with Java - this is a control that is invisible and is just there to reserve some space from the layout system. Does something like this exist in WPF?

4

1 回答 1

1

使用 Visibility.Hidden 而不是 Visibility.Collapsed。然后预留空间。

于 2012-08-14T14:27:15.527 回答