Вот представление:
Код: Выделить всё
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Bomberman.View"
mc:Ignorable="d"
Title="Control Settings">
Код: Выделить всё
// Player control properties
public DelegateCommand SaveControlSettingsCommand { get; private set; }
public PlayerControl Player1Controls { get; set; }
public PlayerControl Player2Controls { get; set; }
public PlayerControl Player3Controls { get; set; }
//In constructor
SaveControlSettingsCommand = new DelegateCommand(param => onSaveControlSettings());
//Control settings (also in constructor)
Player1Controls = _model.Player1Controls;
Player2Controls = _model.Player2Controls;
Player3Controls = _model.Player3Controls;
//Event method
private void onSaveControlSettings()
{
_model.SaveControlSettings(Player1Controls,Player2Controls,Player3Controls);
}
Я делаю что-то не так в предоставленном мной коде? Если нет, то откуда моя проблема? Я больше нигде не занимаюсь настройками управления. Для него есть только метод сохранения в файле _model. Но это не должно переопределять мои элементы управления PlayerXControls в виртуальной машине.
Поскольку я использую привязку TwoWay, моей первой идеей было проверить, не меняет ли что-то в виртуальной машине элементы управления PlayerControls, но я ничего не нашел .
Пожалуйста, помогите! Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/783 ... e-controls
Мобильная версия