Binding error when switching between Pages w/PropertyGrids

Wizard for WPF Forum

Posted 8 years ago by Pat Maneely - Software Engineering Manager, Cobham Aerospace
Version: 11.1.0545
Avatar
I have a series of pages in my wizard. With the exception of the first (Welcome Page), each page has a PropertyGrid.

When I switch between the pages, I get a BindingExpression path error saying that it can't find a previous ViewModel property on the current Page.

System.Windows.Data Error: 39 : BindingExpression path error: 'FlexCommSysData' property not found on 'object' ''WizardPage' (Name='FctConfigSetupWelcomePg')'. BindingExpression:Path=FlexCommSysData.Name; DataItem='WizardPage' (Name='FctConfigSetupWelcomePg'); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')

In addition, once I enter data on the second page, and then switch back to the welcome Page, I get a whole raft of binding error of the type

Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='ActiproSoftware.Windows.Controls.PropertyGrid.TreeListViewItem', AncestorLevel='1''. BindingExpression:Path=IsExpanded; DataItem=null; target element is 'TreeListViewToggleButton' (Name=''); target property is 'IsChecked' (type 'Nullable`1')

Is this indicative of something I'm doing wrong?

Comments (5)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Pat,

The PropertyGrid binding warnings can be disregarded. They are a result of a timing issue in WPF.

The first warning does seem like an issue. It looks like you are trying to bind to a WizardPage.FlexCommSysData property and there is no such property. The Wizard was built long before MVVM because a standard pattern in WPF and there are still some issues with using it with MVVM. So you may need to verify that your bindings are correct.

If that doesn't help please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

Posted 7 years ago by Josh Dice
Avatar
Hi,

I realize this is a very old post but I have the same problem (BindingExpression path error's on valid properties) and have created a sample application that demonstrates the issue.

I'll email the sample application after I post this.

In the sample application you can see that I created a simple wizard that binds to properties in a view model class. Choose a destination folder on the Settings page then click next to go to the finish page. On the finish page I display the folder that was chosen; this value was set on the DestinationFolder property. Look in the output window in Visual Studio and you will see three errors:

System.Windows.Data Error: 40 : BindingExpression path error: 'OptionChosen' property not found on 'object' ''WizardPage' (Name='finishPage')'. BindingExpression:Path=OptionChosen; DataItem='WizardPage' (Name='finishPage'); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')

System.Windows.Data Error: 40 : BindingExpression path error: 'DestinationFolder' property not found on 'object' ''WizardPage' (Name='finishPage')'. BindingExpression:Path=DestinationFolder; DataItem='WizardPage' (Name='finishPage'); target element is 'TextBox' (Name='textBoxFolder'); target property is 'Text' (type 'String')

System.Windows.Data Error: 40 : BindingExpression path error: 'OutputFolderBrowseCommand' property not found on 'object' ''WizardPage' (Name='finishPage')'. BindingExpression:Path=OutputFolderBrowseCommand; DataItem='WizardPage' (Name='finishPage'); target element is 'Button' (Name='buttonBrowse'); target property is 'Command' (type 'ICommand')

Each of the properties are valid and used in the application. The application runs correctly but throws binding errors in Visual Studio.

Am I doing something wrong with the wizard or is this a bug?

I'm using Actipro WPFStudio v11.1.0545

Thanks,
Josh
Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Josh,

This post is only a week old. I think you were probably looking at the "Joined" date. :-)

Regardless, thanks for the sample. This issue has already been fixed in our development builds, but has not been released yet. We are working hard to get the release finished and out the door.

The only work around would be to set the WizardPage.DataContext property manually, which an be done using a Style like the following:
<Style TargetType="wizard:WizardPage">
    <Setter Property="DataContext" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type wizard:Wizard}}, Path=DataContext}" />
</Style>


Actipro Software Support

Posted 7 years ago by Josh Dice
Avatar
Uhh...yeah I was looking at the joined date :)

Thank you for the update and work around. Is there an ETA on the next release?

Thanks,
Josh
Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We're finishing up the last portions of the new code now (v2011.2) and are tweaking. New samples are alomst done. Then we have documentation and deployment updates and it will finally be ready. We'll be starting blog posts about the new features soon.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.