Я создаю форму, которая будет отображаться для элементов управления рядом, как пример ниже.
Проблема в том, что когда я устанавливаю видимость одного элемента управления как «Свернутый», другой не заполняет все окно.
<Window x:Class="Example"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Height="600" Width="600">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button>Button 1</Button>
<Button Grid.Column="1" Visibility="Visible">Button 2</Button>
</Grid>
</Window>
Как сделать так, чтобы «Кнопка 1» заполняла все окна, когда я установил видимость кнопки 2 как свернутую?
Текущий эффект, когда оба видимы:
+---------------------+
| | |
| | |
| | |
| Button 1 | Button 2 |
| | |
| | |
| | |
+---------------------+
Когда кнопка 2 свернута:
+---------------------+
| | |
| | |
| | |
| Button 1 | |
| | |
| | |
| | |
+---------------------+
Желаемая:
+---------------------+
| |
| |
| |
| Button 1 |
| |
| |
| |
+---------------------+