how to databind Breadcrumb.SelectedPath/SelectedItem?

Navigation for WPF Forum

Posted 15 years ago by SeongTae Jeong
Version: 9.1.0502
To reproduce,

1. Open a sample project "SampleApplication-CSharp.VS2008" provided by Actipro.
2. Open a xaml file, ProductSamples\NavigationSamples\QuickStart\BreadcrumbFileSystem\MainControl.xaml
3. About line 88, add a dependency property "SelectedPath" as follows,
<navigation:Breadcrumb x:Name="breadcrumb"
   SelectedPath="{Binding Path=MySelectedPath, ElementName=userControl}"
   Margin="0,10,0,0" RootItem="{Binding XPath=ShellItem}"       ItemContainerStyle="{StaticResource BreadcrumbItemStyle}"
4. Add some code for MySelectedPath in code-behind file.
        string mySelectedPath;
        public string MySelectedPath
            get { return this.mySelectedPath; }
                this.mySelectedPath = value;
5. Run and check whether set_MySelectedPath code is executed whenever you select a menu on breadcrumb control. It's not! (But, I think it has to be executed)

Unfortunately, SelectedItem (Dependency Property) is also not linked to the data-bound property.

Comments (2)

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

The SelectedItem/SelectedPath properties did not bind TwoWay by default. I've updated the property defines to that they do bind TwoWay by default for the next maintenance release.

In the meantime, you can simply add Mode="TwoWay" to your Binding.

Actipro Software Support

Posted 15 years ago by SeongTae Jeong
Thanks a lot. :)
It works well!
I also agree that the default value of Mode have to be TwoWay like other dependency properties in WPF controls
The latest build of this product (v24.1.2) 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.