Posted 15 years ago
by wpf.acp
Version: 9.1.0505
Platform: .NET 3.5
Environment: Windows Vista (32-bit)
I have been experimenting with ribbon, ribbon window and docking features in a worker thread and this all worked without a single issue. Then I have tried adding a simple PropertyGrid to this window and I got the following exception:
'TreeListViewRowPresenter' object cannot be added to 'Border'. Exception has been thrown by the target of an invocation. Error at object 'ActiproSoftware.Windows.Controls.PropertyGrid.Primitives.TreeListViewRowPresenter' in markup file 'ActiproSoftware.PropertyGrid.Wpf30;component/Themes/PropertyGrid/Common.xaml'.
I have created a sample that reproduces the issue. The sample uses the very button as SelectedObject but it really doesn't matter which object is used or even if PropertyGridPropertyItem is used instead.
'TreeListViewRowPresenter' object cannot be added to 'Border'. Exception has been thrown by the target of an invocation. Error at object 'ActiproSoftware.Windows.Controls.PropertyGrid.Primitives.TreeListViewRowPresenter' in markup file 'ActiproSoftware.PropertyGrid.Wpf30;component/Themes/PropertyGrid/Common.xaml'.
I have created a sample that reproduces the issue. The sample uses the very button as SelectedObject but it really doesn't matter which object is used or even if PropertyGridPropertyItem is used instead.
public partial class Window1
{
public Window1()
{
InitializeComponent();
}
private void _button_OnClick(object sender, RoutedEventArgs e)
{
var thread = new Thread(WorkerThread);
thread.TrySetApartmentState(ApartmentState.STA);
thread.Start();
}
private static void WorkerThread(object obj)
{
var win = new Window1();
win.ShowDialog();
}
}
<Window x:Class="PropertyGridThreadBug.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:PropertyGrid="clr-namespace:ActiproSoftware.Windows.Controls.PropertyGrid;assembly=ActiproSoftware.PropertyGrid.Wpf30"
Title="Window1" Height="300" Width="300">
<DockPanel>
<Button x:Name="_button"
DockPanel.Dock="Bottom"
Click="_button_OnClick">
Create Worker Thread
</Button>
<PropertyGrid:PropertyGrid SelectedObject="{Binding ElementName=_button}" />
</DockPanel>
</Window>