I am trying to make a conditional form where you select a server type and, on that value, the fields change. But the problem is the moment when I start this WPF app. My app goes into break mode. But I don't have any clue where or why he goes into break mode.
The moment that I comment 2 of the grids, the application starts with no problem. But as soon as I uncomment these grids, the WPF app fails.
This is the XAML
<Grid Margin="0,0,0,5" Grid.Row="7" Grid.ColumnSpan="2" Background="Yellow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Label Grid.ColumnSpan="2" Grid.Column="0" HorizontalAlignment="Center" FontWeight="Bold" Content="Server settings" />
<Label Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" FontWeight="Bold" Content="Server type:" />
<ComboBox Name="ServerTypCmbx" Grid.Row="1" Grid.Column="1" SelectionChanged="ServerTypCmbx_SelectionChanged"></ComboBox>
<StackPanel Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Grid.RowSpan="3">
<Grid Visibility="Hidden" Name="S7Grid" Background="Purple">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Label Grid.Row="0" HorizontalAlignment="Center" FontWeight="Bold" Content="Server Ip:" />
<TextBox Text="{Binding Path=ServerSetting.Ip}" Margin="0,1" Grid.Row="0" Grid.Column="1"></TextBox>
<Label Grid.Row="1" HorizontalAlignment="Center" FontWeight="Bold" Content="Server Rack:" />
<TextBox Text="{Binding Path=ServerSetting.Rack}" Margin="0,1" Grid.Row="1" Grid.Column="1"></TextBox>
<Label Grid.Row="2" HorizontalAlignment="Center" FontWeight="Bold" Content="Server Slot:" />
<TextBox Text="{Binding Path=ServerSetting.Slot}" Margin="0,1" Grid.Row="2" Grid.Column="1"></TextBox>
</Grid >
<Grid Visibility="Hidden" Name="OPC_UAGrid" Background="Purple">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Label Grid.Row="0" HorizontalAlignment="Center" FontWeight="Bold" Content="Server Adress:" />
<TextBox Text="{Binding Path=ServerSetting.Adress}" Margin="0,1" Grid.Row="0" Grid.Column="1"></TextBox>
<Label Grid.Row="1" HorizontalAlignment="Center" FontWeight="Bold" Content="Server NameUri:" />
<TextBox Text="{Binding Path=ServerSetting.NamespaceUri}" Margin="0,1" Grid.Row="1" Grid.Column="1"></TextBox>
<Label Grid.Row="2" HorizontalAlignment="Center" FontWeight="Bold" Content="Server NameIndex:" />
<TextBox Text="{Binding Path=ServerSetting.NameSpaceIndex}" Margin="0,1" Grid.Row="2" Grid.Column="1"></TextBox>
</Grid>
<Grid Visibility="Hidden" Name="OPC_DAGrid" Background="Purple">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Label Grid.Row="0" HorizontalAlignment="Center" FontWeight="Bold" Content="Server Adress:" />
<TextBox Text="{Binding Path=ServerSetting.Adress}" Margin="0,1" Grid.Row="0" Grid.Column="1"></TextBox>
<Label Grid.Row="1" HorizontalAlignment="Center" FontWeight="Bold" Content="Server Name:" />
<TextBox Text="{Binding Path=ServerSetting.Name}" Margin="0,1" Grid.Row="1" Grid.Column="1"></TextBox>
</Grid>
</StackPanel>
</Grid>