Hi,
I have a DocumentContentHost containing a few tab group panes, and I've implemented an attached property (as presented in this forum) to raise a routed event when the pane location property is changed. In my routed event handler, there is a check that if the pane doesn't satisfy a certain condition then it will programmatically move the pane to floating, when this line is executed it's throwing a null reference exception. Can you please shed some light on this? Please see code below:
private
void contentpane_PaneLocationChanged(object sender, GenericRoutedEventArgs<PaneLocation> e)
{
if (!conditionSatisfied)
ContentPaneCommands.ChangeToFloatingOnly.Execute("", pane); //throws below exception ....
}
Exception:
System.NullReferenceException occurred
Message="Object reference not set to an instance of an object."
Source="Infragistics3.Wpf.DockManager.v9.2"
StackTrace:
at Infragistics.Windows.DockManager.DockManagerUtilities.MovePane(ContentPane pane, IContentPaneContainer newContainer, Nullable`1 newIndex, PaneLocation newLocation)
InnerException:
Thanks,
Tess
Thanks for your reply. Using Dispatcher.BeginInvoke does resolve the issue.
The PaneLocation is an inherited property so its going to be set while the element is being added to the logical/visual tree so in all likelihood you're manipulating the element while the previous process that caused the panelocation to change in the first place is being processed. At the very least you should do a Dispatcher.BeginInvoke and asynchronously execute that command so whatever processing is occuring can be completed. If there is still an issue then please provide a sample that demonstrates the issue.