Я хочу иметь возможность обновлять ComboBox внутри моей Gird. Я предполагаю, что мне нужна какая-то система событий.DataContext: Обновление элемента ItemSource comboBox
Я обязан это следующим образом:
<ComboBox Name="ScreenLocations" Grid.Row="1" Margin="0,0,0,175" ItemsSource="{Binding Path=CurrentPlayer.CurrentLocation.CurrentDirections}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path= Location}"/>
моего xaml.cs выглядит следующим образом:
public partial class MainWindow : Window
{
GameSession _gameSession;
public MainWindow()
{
InitializeComponent();
_gameSession = new GameSession();
DataContext = _gameSession;
}
}
Я хочу, чтобы иметь возможность изменить CurrentDirections
свойства и иметь его обновленным в пользовательский интерфейс.
Класс и свойства Я его обязан это:
public class Location
{
public int ID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Quest[] AvailableQuests { get; set; }
public Monster[] LocationMonsters { get; set; }
public Location[] CurrentDirections { get; set; }
public Location(string name, string description, Quest[] availableQuests, int id)
{
Name = name;
Description = description;
AvailableQuests = availableQuests;
ID = id;
CurrentDirections = new Location[] { };
LocationMonsters = new Monster[] { };
AvailableQuests = new Quest[] { };
}
}
посмотрел op в INotiftyPropertyChanged и достиг того, что я хотел. Спасибо. –