Select to view content in your preferred language

ProWindow Data Binding and MVVM

352
1
Jump to solution
01-30-2025 07:29 AM
JoePolaski
Occasional Contributor

I have been struggling a bit with ProWindows and Data Binding. For some background, I am trying to implement a ProWindow and I have:

- Created a separate ViewModel that inherits PropertyChangedBase
- Set the data context properly in my code behind
-  Tried to bind data to update a public boolean property that is set with PropertyChangedBase.SetProperty() to change the IsSelected value of multiple TreeViewItems that are bound in the following way:

IsSelected="{Binding AllDataSourceSelectedState, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

- I have also implemented a custom type which implements INotifyPropertyChanged so that I can reduce the code clutter for properties and tried using this instead as a second option. (this works absolutely fine in dockpanes)

This boolean is being changed on a mouse up event. I have stepped through the debugger and ensured it is changing and that the property changed event is happening. I have even manually called NotifyPropertyChanged with no luck. It seems like no matter what I do, I cannot get data to bind to a ProWindow after the initial loading of the window. I have tried so many things. Dockpanes on the other hand work awesome for binding data.

I have already looked at the community sample for ProWindows MVVM and I didn't find it very helpful for my situation. Any advice would be appreciated. Thanks in advance.


0 Kudos
1 Solution

Accepted Solutions
JoePolaski
Occasional Contributor

I was able to overcome this issue. I think in this particular scenario it ended up being more to do with some of the nuances of TreeViews in general. However, I have had issues with binding things in the past in windows before. Anyway, in the end using the VisualTreeHelper to traverse the TreeView and toggle all the nodes IsSelected values to false did the trick. In this scenario traditional data binding was not successful.

View solution in original post

0 Kudos
1 Reply
JoePolaski
Occasional Contributor

I was able to overcome this issue. I think in this particular scenario it ended up being more to do with some of the nuances of TreeViews in general. However, I have had issues with binding things in the past in windows before. Anyway, in the end using the VisualTreeHelper to traverse the TreeView and toggle all the nodes IsSelected values to false did the trick. In this scenario traditional data binding was not successful.

0 Kudos