custom horizontal scrollbar

SyntaxEditor for WPF Forum

Posted 5 years ago by Martin - Blaise - 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 5 years 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 5 years ago by Martin - Blaise - 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 5 years 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 5 years ago by Martin - Blaise - 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 (v24.1.1) 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.