private void CreateImageClick(object sender, RoutedEventArgs e)
        {
            // lame workaround to toggle scrollbar to fix UI
            dataGrid.IsEnabled = false;
            dataGrid.SelectedItems.Clear();
            dataGrid.VerticalScrollBarVisibility   = ScrollBarVisibility.Visible;
            dataGrid.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;

            Task.Delay(50).ContinueWith((bleh) =>
            {
                Dispatcher.InvokeAsync(() =>
                {
                    dataGrid.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
                    dataGrid.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
                    SpellRowsView.ToList().ForEach(spr => spr["IconColor"] = EMPTYICON);
                    dataGrid.Items.Refresh();
                    Task.Delay(50).ContinueWith((bleh2) => Dispatcher.InvokeAsync(() =>
                    {
                        DataGridUtils.CreateImage(dataGrid, titleLabel);
                        SpellRowsView.ToList().ForEach(spr => spr["IconColor"] = ACTIVEICON);
                    }), TaskScheduler.Default);
                });
            }, TaskScheduler.Default);
        }
Exemplo n.º 2
0
        private void CreateImageClick(object sender, RoutedEventArgs e)
        {
            // lame workaround to toggle scrollbar to fix UI
            dataGrid.IsEnabled    = false;
            dataGrid.SelectedItem = null;
            dataGrid.VerticalScrollBarVisibility   = ScrollBarVisibility.Visible;
            dataGrid.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;

            Task.Delay(50).ContinueWith((bleh) =>
            {
                Dispatcher.InvokeAsync(() =>
                {
                    dataGrid.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
                    dataGrid.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
                    dataGrid.Items.Refresh();
                    Task.Delay(50).ContinueWith((bleh2) => Dispatcher.InvokeAsync(() => DataGridUtils.CreateImage(dataGrid, titleLabel)), TaskScheduler.Default);
                });
            }, TaskScheduler.Default);
        }