public ChangeCarParentDialog(CarObject car) {
InitializeComponent();
DataContext = this;
Buttons = new[] {
OkButton,
CreateExtraDialogButton(ControlsStrings.CarParent_MakeIndependent, () => {
Car.ParentId = null;
Close();
}),
CancelButton
};
Car = car;
Filter = car.Brand == null ? "" : @"brand:" + car.Brand;
CarsListView = new ListCollectionView(CarsManager.Instance.LoadedOnly.Where(x => x.ParentId == null && x.Id != Car.Id).ToList()) {
CustomSort = this
};
UpdateFilter();
if (car.Parent == null) {
CarsListView.MoveCurrentToPosition(0);
} else {
CarsListView.MoveCurrentTo(car.Parent);
}
Closing += CarParentEditor_Closing;
}