Posted 16 years ago by Michael
Version: 4.0.0457
Platform: .NET 3.5
Environment: Windows Vista (32-bit)
Avatar
I created two tabs(tool windows) in a ToolWindowContainer. I painted something in one toolwindow when the window is loaded in the C# code.

Here is the problem: I click the tab of the other window then click back to the window that I painted, the content dispears. But if I drag the window around, rearrange the windows layout, sometime the content can randomly reappear.

Here is the test code

<Window x:Class="TestBug.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared" 
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking" 
    Title="Window1" Height="300" Width="300">
    <docking:DockSite x:Name="dockSite">
        <docking:ToolWindowContainer>
            <docking:ToolWindow Name="folderWindow" Title="Tool Window 1" Loaded="folderWindow_Loaded">
                <TreeView x:Name="folderTree" Background="AliceBlue" HorizontalContentAlignment="Stretch" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling">
                    <TreeView.Resources>
                        <Style TargetType="{x:Type TreeViewItem}">
                            <Setter Property="HeaderTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">

                                            <TextBlock Text="{Binding}" Margin="5,0" />

                                        </StackPanel>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </TreeView.Resources>
                </TreeView>
            </docking:ToolWindow>
            <docking:ToolWindow Title="Tool Window 2" />
        </docking:ToolWindowContainer>
    </docking:DockSite>
</Window>

And the corresponding c# code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
namespace TestBug
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        private readonly object dummyNode = null;
        public Window1()
        {
            InitializeComponent();
        }
        private void folder_Expanded(object sender, RoutedEventArgs e)
        {
            TreeViewItem item = (TreeViewItem)sender;
            if (item.Items.Count == 1 && item.Items[0] == dummyNode)
            {
                item.Items.Clear();
                try
                {
                    foreach (string s in Directory.GetDirectories(item.Tag.ToString()))
                    {
                        TreeViewItem subitem = new TreeViewItem();
                        subitem.Header = s.Substring(s.LastIndexOf("\\") + 1);
                        subitem.Tag = s;
                        subitem.FontWeight = FontWeights.Normal;
                        subitem.Items.Add(dummyNode);
                        subitem.Expanded += new RoutedEventHandler(folder_Expanded);
                        item.Items.Add(subitem);
                    }
                }
                catch (Exception) { }
            }
        }
 



        private void folderWindow_Loaded(object sender, RoutedEventArgs e)
        {
            folderTree.Items.Clear();
            foreach (string s in Directory.GetLogicalDrives())
            {
                TreeViewItem item = new TreeViewItem();
                item.Header = s;
                item.Tag = s;
                item.FontWeight = FontWeights.Normal;
                item.Items.Add(dummyNode);
                item.Expanded += new RoutedEventHandler(folder_Expanded);
                folderTree.Items.Add(item);
            }
        }

    }
}

[Modified at 09/20/2008 04:45 AM]

Comments (1)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Michael,

Actually we've had a fix for this issue for a couple weeks but it will roll out with WPF Studio v4.5, which we are working very hard to get out today.

Something Microsoft changed in .NET 3.5 SP1 caused this issue with the TransitionPresenter where it may not show content in a certain scenario when no Transition has been set. This never happened before SP1.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.