protected override void OnLoaded() { this.viewModel = new ViewModelCustomMark(this.name, this.isOwner); 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; }