Binding Error On Load Of NavigableSymbolSelector

SyntaxEditor for WPF Forum

Posted 4 years ago by Robert Walker
Version: 19.1.0684
Avatar

Using XAML code from SyntaxEditor:

			<docking:Workspace x:Name="workspace">
 
				<DockPanel>
					<editor:NavigableSymbolSelector x:Name="symbolSelector" DockPanel.Dock="Top" Margin="0,0,0,1" SyntaxEditor="{Binding ElementName=editor}" />
 
					<!-- SyntaxEditor -->
					<editor:SyntaxEditor x:Name="editor"
										 AreIndentationGuidesVisible="True"
										 AreWordWrapGlyphsVisible="True"

Yields the following Binding Error when the editor loads:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=editor'. BindingExpression:(no path); DataItem=null; target element is 'NavigableSymbolSelector' (Name='symbolSelector'); target property is 'SyntaxEditor' (type 'SyntaxEditor')

Is this a "red herring" and I can ignore it?

Comments (5)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Robert,

If everything is working at run-time then you can probably ignore it.  I'm not sure why that would be happening since the Binding looks ok to me.  I wonder if you moved the interior of the Workspace into a UserControl and loaded the UserControl as the Workspace child instead, if the binding error disappeared?


Actipro Software Support

Posted 4 years ago by Scott Jeslis
Avatar

Hi Guys,

Thanks. This is actually my (Scott) "problem" Robert logged it initially for me. It's odd because I have a similar issue with SyntaxEditor's bound ZoomLevel:

					<editor:SyntaxEditor x:Name="editor"
										 AreIndentationGuidesVisible="True"
										 AreWordWrapGlyphsVisible="True"
										 IsLineNumberMarginVisible="True"
										 ZoomLevel="{Binding ElementName=scaleSlider, Path=Value}"

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=scaleSlider'. BindingExpression:Path=Value; DataItem=null; target element is 'SyntaxEditor' (Name='editor'); target property is 'ZoomLevel' (type 'Double')

<StatusBarItem Grid.Column="4">
					<StackPanel Margin="0,0,16,0" Orientation="Horizontal">
						<Slider x:Name="scaleSlider" Width="80" Value="1.0" Minimum="0.5" Maximum="3.0" LargeChange="0.5" SmallChange="0.1" VerticalAlignment="Center" 
			IsSnapToTickEnabled="True" TickFrequency="0.1" 
			Style="{DynamicResource {x:Static themes:SharedResourceKeys.StatusBarEmbeddedSliderStyleKey}}" />
						<TextBlock Text="{Binding ElementName=scaleSlider, Path=Value, Converter={StaticResource PercentageConverter}, ConverterParameter=%}" VerticalAlignment="Center" />
					</StackPanel>
				</StatusBarItem>
Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Scott,

I tried putting the code below in a Grid in a Window and I didn't get any binding errors:

<Slider x:Name="scaleSlider" Width="80" Value="1.0" Minimum="0.5" Maximum="3.0" LargeChange="0.5" SmallChange="0.1" VerticalAlignment="Center" 
	IsSnapToTickEnabled="True" TickFrequency="0.1"  />
		
<editor:SyntaxEditor Grid.Row="2" ZoomLevel="{Binding ElementName=scaleSlider, Path=Value}" />

Do you seem the binding error if you place the code above in Grid in a new Window?


Actipro Software Support

Posted 4 years ago by Scott Jeslis
Avatar

Investigating. I have everything in a UserControl.

Posted 4 years ago by Scott Jeslis
Avatar

For Slider binding issue I just bound value to a dependency property in interest of time. It was a real error since SyntaxEditor wasn't responding to the zoom level change. I got tired of trying to resolve the WPF hierarchy :-)

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.