MultiSelectTreeView icon indicating copy to clipboard operation
MultiSelectTreeView copied to clipboard

BindingExpression path error: '(Controls:MultiSelectTreeView.*)'

Open redsolo opened this issue 8 years ago • 3 comments

WpfTreeview.zip

Im getting BindingExpression errors for every item I add to the MultiSelectTreeView. I have a very simple tree view where all I have done is set the ItemSource and SelectedItems in the XAML. But when I add 1000 entries into it, I get the following binding expression failures for each and every item:

System.Windows.Data Warning: 40 : BindingExpression path error: '(Controls:MultiSelectTreeView.HoverHighlighting)' property not found on 'object' ''MultiSelectTreeView' (Name='')'. BindingExpression:Path=(Controls:MultiSelectTreeView.HoverHighlighting); DataItem='MultiSelectTreeView' (Name=''); target element is 'MultiSelectTreeViewItem' (Name=''); target property is 'HoverHighlighting' (type 'Boolean')
System.Windows.Data Warning: 40 : BindingExpression path error: '(Controls:MultiSelectTreeView.ItemIndent)' property not found on 'object' ''MultiSelectTreeView' (Name='')'. BindingExpression:Path=(Controls:MultiSelectTreeView.ItemIndent); DataItem='MultiSelectTreeView' (Name=''); target element is 'MultiSelectTreeViewItem' (Name=''); target property is 'ItemIndent' (type 'Int32')
System.Windows.Data Warning: 40 : BindingExpression path error: '(Controls:MultiSelectTreeView.IsKeyboardMode)' property not found on 'object' ''MultiSelectTreeView' (Name='')'. BindingExpression:Path=(Controls:MultiSelectTreeView.IsKeyboardMode); DataItem='MultiSelectTreeView' (Name=''); target element is 'MultiSelectTreeViewItem' (Name=''); target property is 'IsKeyboardMode' (type 'Boolean')

Im not sure what I should do to remove these, as those seems to be TreeView related and not related to my view models.

redsolo avatar May 16 '17 12:05 redsolo

I have the same issue and would also appreciate a solution for it.

TFTomSun avatar May 27 '17 11:05 TFTomSun

Me too.

AnotherKiwi avatar Jul 10 '17 18:07 AnotherKiwi

For everyone who wants to fix that issue on his own: search for:

	<!-- Pass on the MultiSelectTreeView' HoverHighlighting value to each item because we couldn't access it otherwise in the triggers -->
	<Setter Property="HoverHighlighting"
		Value="{Binding (Controls:MultiSelectTreeView.HoverHighlighting), RelativeSource={RelativeSource AncestorType={x:Type Controls:MultiSelectTreeView}}, Mode=OneWay, FallbackValue=False}"/>
	<Setter Property="ItemIndent"
		Value="{Binding (Controls:MultiSelectTreeView.ItemIndent), RelativeSource={RelativeSource AncestorType={x:Type Controls:MultiSelectTreeView}}, Mode=OneWay, FallbackValue=13}"/>
	<Setter Property="IsKeyboardMode"
		Value="{Binding (Controls:MultiSelectTreeView.IsKeyboardMode), RelativeSource={RelativeSource AncestorType={x:Type Controls:MultiSelectTreeView}}, Mode=OneWay, FallbackValue=False}"/>

and replace with:

	<!-- Pass on the MultiSelectTreeView' HoverHighlighting value to each item because we couldn't access it otherwise in the triggers -->
	<Setter Property="HoverHighlighting"
		Value="{Binding Path=HoverHighlighting, RelativeSource={RelativeSource AncestorType={x:Type Controls:MultiSelectTreeView}}, Mode=OneWay, FallbackValue=False}"/>
	<Setter Property="ItemIndent"
		Value="{Binding Path=ItemIndent, RelativeSource={RelativeSource AncestorType={x:Type Controls:MultiSelectTreeView}}, Mode=OneWay, FallbackValue=13}"/>
	<Setter Property="IsKeyboardMode"
		Value="{Binding Path=IsKeyboardMode, RelativeSource={RelativeSource AncestorType={x:Type Controls:MultiSelectTreeView}}, Mode=OneWay, FallbackValue=False}"/>

The files that contain that xaml code are: MultiSelectTreeViewItem.Aero2.xaml MultiSelectTreeViewItem.Classic.xaml MultiSelectTreeViewItem.Luna.xaml MultiSelectTreeViewItem.Aero.xaml

TFTomSun avatar Oct 02 '17 08:10 TFTomSun