Ошибка возникает при указании ресурса с ViewModel моего класса:
<Window x:Class="KTM.TouristsListWnd"
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:KTM"
mc:Ignorable="d"
Title="TouristsList" Height="388.102" Width="1001.393" Loaded="Window_Loaded">
<Window.DataContext>
<!-- ошибка воникает здесь -->
<local:TouristsListViewModel />
</Window.DataContext>
не смотря на то что класс находится в области видимости (public)?
public class TouristsListViewModel
UPD: конструктор класса:
public TouristsListViewModel()
{
try {
conn.Open();
MySqlCommand cmd = new MySqlCommand("SELECT * FROM tourmanager.tourists;", conn);
MySqlDataAdapter adp = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
foreach (DataRow dr in ds.Tables[0].Rows) {
_tourists.Add(new Tourist((int)dr["id"], (string)dr["firstname"], (string)dr["secondname"],
(string)dr["patronymic"], (string)dr["passport"], (string)dr["sex"]));
}
} catch (MySqlException ex) {
throw new Exception("", ex);
} finally {
conn.Close();
}
}