private void Min_Click(object sender, RoutedEventArgs e) { var windowObject = this.DataContext as TaskBarItem; if (windowObject != null && windowObject._openWindows.Count > 0) windowObject.Minimize(); }