protected override void OnLoaded() { this.viewModel = new ViewModelPartyMember(this.partyMemberName, commandRemove: null, Visibility.Collapsed); this.DataContext = this.viewModel; this.UpdateLayout(); var textBlock = this.GetByName <FrameworkElement>("NameGrid"); Canvas.SetLeft(textBlock, -textBlock.ActualWidth / 2); }
protected override void OnUnloaded() { this.DataContext = null; this.viewModel?.Dispose(); this.viewModel = null; }