I am trying to have a clickable TreeViewItem.
xaml:
<TreeViewItem Header="Csv Logs" MouseLeftButtonUp="{Binding Path=CsvLocationClick}"/>
CodeBehind:
public MouseButtonEventHandler CsvLocationClick
{ get { return OnCsvLocationClick; } }
But at runtime, I get the error:
System.Windows.Markup.XamlParseException: ''Provide value on 'System.Windows.Data.Binding' threw an exception.' Line number '18' and line position '54'.'
Inner Exception
InvalidCastException: Unable to cast object of type 'System.Reflection.RuntimeEventInfo' to type 'System.Reflection.MethodInfo'.
What does this error mean? How is it fixed?
You cannot bind to
MouseLeftButtonUp. It's an event to which you are expected to hook up an event handler:Code behind: