using System;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Docking;

namespace DifferentToolWindowStyles
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Task.Run(() =>
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    var pane = this.radDocking.Panes.FirstOrDefault(p => p.Name == "firstPane");
                }));

            });
        }

        private void Button_Click1(object sender, RoutedEventArgs e)
        {
            var viewModel = (this.DataContext as ViewModel);
           viewModel.IsHidden = !viewModel.IsHidden;
        }
    }

    public class ViewModel : ViewModelBase
    {
        private bool isHidden = false;

        public bool IsHidden
        {
            get { return isHidden; }

            set
            {
                if (this.isHidden != value)
                {
                    MessageBox.Show($"IsHidden = {value}");
                    this.isHidden = value;
                    this.OnPropertyChanged("IsHidden");
                }
            }
        }

    }
}
