I have a method that renames a tree element.
ClickTreeViewItem is a property in my class that returns the element that is clicked via the "GetClickElement<T>" call.
The check confirms that the clicked element is not null, but the same property within the dispatcher section returns null. The Dispatcher allows us to run the method on the UI Main thread.
Any thoughts on why this would be happening?
Thanks
Paul
private void RenameAction()
{
if (this.ClickedTreeViewItem != null)
{
Dispatcher.BeginInvoke(() =>
{
this.ClickedTreeViewItem.BeginEdit();
});
}
else
{
Dispatcher.BeginInvoke(() =>
{
this.m_SelectedContextEntity.BeginEdit();
});
}
}
if (this.ClickedTreeViewItem != null)
{
Dispatcher.BeginInvoke(() =>
{
this.ClickedTreeViewItem.BeginEdit();
});
}
else
{
Dispatcher.BeginInvoke(() =>
{
this.m_SelectedContextEntity.BeginEdit();
});
}
}
ClickTreeViewItem is a property in my class that returns the element that is clicked via the "GetClickElement<T>" call.
The check confirms that the clicked element is not null, but the same property within the dispatcher section returns null. The Dispatcher allows us to run the method on the UI Main thread.
Any thoughts on why this would be happening?
Thanks
Paul
5 Answers, 1 is accepted
0
Hello Paul Brun,
Apparently the clicked element is null in the dispatcher because the check is executed in different timeframe than the check in the upper if. You could assign the return value of the function call to a local variable and use that variable for checks and later operations in the method.
Hope this helps. Please let us know if you have further concerns.
Greetings,
Hristo
the Telerik team
Apparently the clicked element is null in the dispatcher because the check is executed in different timeframe than the check in the upper if. You could assign the return value of the function call to a local variable and use that variable for checks and later operations in the method.
Hope this helps. Please let us know if you have further concerns.
Greetings,
Hristo
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Paul Brun
Top achievements
Rank 2
answered on 26 Sep 2011, 12:08 PM
Thanks for the suggestion. I have implemented that, was just curious why it worked in a previous release and not the current one. Or, was it just luck that it worked???
Regards,
Paul
0
Hello Paul Brun,
Petar Mladenov
the Telerik team
Probably it is not the release version and it is the inconsistent (due to the asynchronous work) behavior of the Disaptcher. What are the two release versions that you compare?
All the best,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Paul Brun
Top achievements
Rank 2
answered on 29 Sep 2011, 01:04 PM
0
Hi Paul Brun,
Petar Mladenov
the Telerik team
You could also try the Q2 2011 SP1 (0920) version of RadControls but still, we think that it is more like a "Dispatcher-timing" result than a change in the RadTreeView from Q1 SP1 to Q2. Feel free to ask if you have further questions.
Kind regards,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>