У меня есть StackPanel
в моем приложении WinRT С# Metro, которое я хочу использовать в качестве контейнера для пары label/value (TextBlock
и TextBox
) следующим образом:
<StackPanel Orientation="Horizontal" Width="400">
<TextBlock Text="Label" Width="150" />
<TextBox Text="Value" />
</StackPanel>
Теперь я хочу, чтобы TextBox автоматически заполнил оставшееся горизонтальное пространство StackPanel. Это возможно в любом случае? HorizontalAlignment
/HorizontalContentAlignment
не работают.
Я знаю, что альтернативой было бы определить для этого Grid
. Проблема в том, что у меня есть эта конструкция несколько раз и вы хотите использовать ее в определении Style
. Я не хочу определять определение Grid строками и столбцами x раз...
Возможно, альтернативой будет определение пользовательского элемента управления, но я надеялся, что будет легко получить растяжение TextBox
.