Your DentistryOOP.View.MainWindow
type's constructor threw an exception. Put a breakpoint in the constructor and run your code again. Without seeing the code it is hard to say but your constructor shouldn't really be doing too much since it is just now being created. None of its fields/properties would have been set yet.
How to fix XamlReader.RewrapException(ex, xamlLineInfo, baseUri);
Груша Максим Олександрович
0
Reputation points
Here is the error
System.Windows.Markup.XamlParseException: "'The invocation of the constructor on type 'DentistryOOP.View.MainWindow' that matches the specified binding constraints threw an exception.' Line number '6' and line position '9'."
Here is the code of MainWindor
<Window x:Class="DentistryOOP.View.MainWindow"
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"
xmlns:local="clr-namespace:DentistryOOP"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<TabControl Grid.Row="0">
<TabItem Name="UserTab">
<TabItem.Header>
<TextBlock Text="Users"/>
</TabItem.Header>
<ListView x:Name="ViewAllUsers" ItemsSource="{Binding AllUsers}">
<ListView.View>
<GridView>
<GridViewColumn Header=" Id " DisplayMemberBinding="{Binding Path=Id}"/>
<GridViewColumn Header=" Name " DisplayMemberBinding="{Binding Path=Name}"/>
<GridViewColumn Header=" SurName" DisplayMemberBinding="{Binding Path=Surname}"/>
<GridViewColumn Header=" Phone " DisplayMemberBinding="{Binding Path=Phone}"/>
<GridViewColumn Header=" Password " DisplayMemberBinding="{Binding Path=Password}"/>
</GridView>
</ListView.View>
</ListView>
</TabItem>
<TabItem Name="PatientTab">
<TabItem.Header>
<TextBlock Text="Patients"/>
</TabItem.Header>
<ListView x:Name="ViewAllPatients" ItemsSource="{Binding AllPatients}">
<ListView.View>
<GridView>
<GridViewColumn Header=" Id " DisplayMemberBinding="{Binding Path=Id}"/>
<GridViewColumn Header=" Name " DisplayMemberBinding="{Binding Path=Name}"/>
<GridViewColumn Header=" SurName " DisplayMemberBinding="{Binding Path=Surname}"/>
<GridViewColumn Header=" Phone " DisplayMemberBinding="{Binding Path=Phone}"/>
<GridViewColumn Header=" Diagnos " DisplayMemberBinding="{Binding Path=Diagnos}"/>
</GridView>
</ListView.View>
</ListView>
</TabItem>
<TabItem Name="DoctorTab">
<TabItem.Header>
<TextBlock Text="Doctors"/>
</TabItem.Header>
<ListView x:Name="ViewAllDoctors" ItemsSource="{Binding AllDoctors}">
<ListView.View>
<GridView>
<GridViewColumn Header=" Id " DisplayMemberBinding="{Binding Path=Id}"/>
<GridViewColumn Header=" Name " DisplayMemberBinding="{Binding Path=Name}"/>
<GridViewColumn Header=" SurName" DisplayMemberBinding="{Binding Path=Surname}"/>
<GridViewColumn Header=" Phone " DisplayMemberBinding="{Binding Path=Phone}"/>
<GridViewColumn Header=" Position " DisplayMemberBinding="{Binding Path=Position}"/>
</GridView>
</ListView.View>
</ListView>
</TabItem>
<TabItem Name="SessionTab">
<TabItem.Header>
<TextBlock Text="Sessions"/>
</TabItem.Header>
<ListView x:Name="ViewAllSessions" ItemsSource="{Binding AllSessions}">
<ListView.View>
<GridView>
<GridViewColumn Header=" Date " DisplayMemberBinding="{Binding Path=Date}"/>
<GridViewColumn Header=" IdDoctor " DisplayMemberBinding="{Binding Path=IdDoctor}"/>
<GridViewColumn Header=" IdPatient " DisplayMemberBinding="{Binding Path=IdPatient}"/>
</GridView>
</ListView.View>
</ListView>
</TabItem>
</TabControl>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Новий користувач" Margin="5" Command="{Binding OpenAddNewUserWnd}"/>
<Button Content="Новий доктор" Margin="5" Command="{Binding OpenAddNewDoctorWnd}"/>
<Button Content="Новий пацієнт" Margin="5" Command="{Binding OpenAddNewPatientWnd}"/>
<Button Content="Новий сеанс" Margin="5" Command="{Binding OpenAddNewSessionWnd}"/>
</StackPanel>
</Grid>
```</Window>
1 answer
Sort by: Most helpful
-
Michael Taylor 54,806 Reputation points
2024-04-26T14:14:53.62+00:00