Wpf swap between documents

Wpf swap between documents

sonicer
Collaborator Collaborator
167 Views
2 Replies
Message 1 of 3

Wpf swap between documents

sonicer
Collaborator
Collaborator

I have a modal WPF form with a ComboBox component that loads all dimension types in the project. When I switch to a different active project, is it possible to update the ComboBox source?

 

 

I tryed ViewActivated event. But It doesn't work.

 

Does anyone have a sample project I could use for inspiration?

thx. 

 

 

0 Likes
168 Views
2 Replies
Replies (2)
Message 2 of 3

ctm_mka
Collaborator
Collaborator

you would need to switch the active document first (Document Opened event maybe?) then ping your ViewActivated event.

0 Likes
Message 3 of 3

TripleM-Dev.net
Advisor
Advisor

Check the SDK samples.

 

Also what doesn't work with ViewActivated exactly?

Keep in mind the event is raised for each view activated change, even of the same document!

 

I use it, but to reduce updating the Combox on each changed view, cache the document Hash (document.GetHashCode) of the last update. If the document in the current ViewActivated event is equal then don't update the ComboBox.

 

If you also need live update of it's content when new types are created, renamed, or deleted you will need to check additional events

 

- Michel

0 Likes