Posted 10 years ago by Bradley
Avatar
I haven't used WPF that much so the solution to this is probably pretty easy. In the ide I'm developing it will have multiple syntax editor controls each being hosted in a tab, much like VS does for each source file. When the user clicks new the "host" creates a new EditorWindow(a usercontrol), creates a new tab, and tells the tab to display the EditorWindow it created, and then updates a local variable called currentWindow (of type EditorWindow) with the one that's currently active. Inside the EditorWindow is the syntax editor whose name is textEditor. What I'm trying to do is take this code from the quick start source
                        <StackPanel>
                            <CheckBox IsChecked="{Binding ElementName=Control, Path=currentWindow.textEditor.IsIndicatorMarginVisible}" Content="Indicator margin visible" />
                            <CheckBox IsChecked="{Binding ElementName=Control, Path=currentWindow.textEditor.IsLineNumberMarginVisible}" Content="Line number margin visible" />
                            <CheckBox IsChecked="{Binding ElementName=Control, Path=currentWindow.textEditor.IsRulerMarginVisible}" Content="Ruler margin visible (useful for fixed-width fonts only)" />
                            <CheckBox IsChecked="{Binding ElementName=Control, Path=currentWindow.textEditor.IsSelectionMarginVisible}" Content="Selection margin visible" />
                        </StackPanel>
put that in the host controls xaml, and bind the checkboxes to the syntax editor. I've tried a couple different things to no avail. Control is the name of the window hosting all the tabs, and path is obviously supposed to be the property that the checkboxes are bound too.

Comments (2)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Bradley,

Maybe it's that currentWindow is a local variable. I would think that it would need to be a property on your Control in order for it to work.


Actipro Software Support

Posted 10 years ago by Bradley
Avatar
That was a mistake on my part, it actually was a property. The issue turned out to be that the binding wasn't getting updated. I changed currentWindow from a property to a DependencyProperty and now all the bindings get updated properly. Thanks.
The latest build of this product (v2019.1 build 0683) 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.