custom horizontal scrollbar

SyntaxEditor for WPF Forum

Posted 1 month ago by Martin de Jong - Statistics Netherlands
Version: 18.1.0681
Avatar

Is sort of a newbee question:)

I have a combobox docked in the right down corner. I rather would have it in the horizontal scrollbar area and shrink the scrollbar a bit. Can i overrule the template of the scrollbar or do i have to copy the compleet XAML of the syntax editor.

Or how should it be done?

Greetz Martin

Comments (4)

Answer - Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Martin,

I think you are looking for our scrollbar tray feature.  Please see the "SyntaxEditor / User Interface Features / Editor View Features / Scrolling" topic in the documentation that comes with the product, and the last several sections within that.  It shows how you can add any UI element on the sides of the scrollbars.


Actipro Software Support

Posted 1 month ago by Martin de Jong - Statistics Netherlands
Avatar

That looks promising. However i can not access the control within the DataTemplate.

<DataTemplate x:Key="SyntaxEditorScrollBarTray">
        <controls:SectionComboBox x:Name="sectionComboBox" MinWidth="50" />
</DataTemplate>

I can retrieve this template and assign it to my editor, it is visible:

var db = new ResourceDictionary();
            db.Source = new Uri("StatNeth.Blaise.IDE.Base;component/Resources.xaml", UriKind.RelativeOrAbsolute);
            var dt = db["SyntaxEditorScrollBarTray"] as DataTemplate;
            this.ScrollBarTrayRightTemplate = dt;

But i can not access the sectionComboBox in any way, e.g. 

            _sectionCombo = _editor.Template.FindName("sectionComboBox", _editor) as Base.Controls.SectionComboBox;

Maybe you can help me, how can i access a named control in this syntaxeditor?

Thank you in advance:)

Answer - Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Martin,

You could probably search down the visual tree.  We have helper methods in our VisualTreeHelperExtended class like this that can assist:

var sectionComboBox = VisualTreeHelperExtended.GetFirstDescendant(syntaxEditor, typeof(SectionComboBox)) as SectionComboBox;


Actipro Software Support

Posted 1 month ago by Martin de Jong - Statistics Netherlands
Avatar

Hi

In the Load event i track down the element

_sectionComboBox = ActiproSoftware.Windows.Media.VisualTreeHelperExtended.GetFirstDescendant(this, typeof(IDE.Base.Controls.SectionComboBox)) as IDE.Base.Controls.SectionComboBox;

which correctly gets the control. Still a bit doubtfull about the timing, but for now it works.

Thanks.

The latest build of this product (v2019.1 build 0682) was released 3 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.