0

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>
renatodamas
  • 16,555
  • 8
  • 30
  • 51
Elty
  • 72
  • 1
  • 13
  • Are there any further information or error messages? – M Stoerzel Mar 29 '18 at 11:25
  • nope just a black screen where vs say: "Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code)." – Elty Mar 29 '18 at 11:26
  • Try to continue the execution with the mentioned method from [here](https://stackoverflow.com/questions/46634776/your-app-has-entered-a-break-state-but-there-is-no-code-to-show-because-all-thr). Then you should see the stack trace. – M Stoerzel Mar 29 '18 at 11:30
  • It can be solved by deleting the page/window/user-control , recreating it , add each line back to XAML and as soon as u add one line, debug it ....This will solve the issue or atleast narrow it down – Software Dev Mar 29 '18 at 11:30
  • @MStoerzel,you cannot continue when in beak mode – Software Dev Mar 29 '18 at 11:31

1 Answers1

0

i found the solution.

in the output window you can see that it gives an error from the presentation dll that it can't bind one or two way on a property. That property was private set

before:

public string Adress { get; private set; }
public string NamespaceUri { get; private set; }
public ushort NameSpaceIndex { get; private set; }

After

public string Adress { get; set; }
public string NamespaceUri { get; set; }
public ushort NameSpaceIndex { get; set; }
Elty
  • 72
  • 1
  • 13