Skip to content

Instantly share code, notes, and snippets.

@sandrinodimattia
Created July 23, 2012 07:00
Show Gist options
  • Save sandrinodimattia/3162350 to your computer and use it in GitHub Desktop.
Save sandrinodimattia/3162350 to your computer and use it in GitHub Desktop.
ScrollBar OnApplyTemplate
public override void OnApplyTemplate()
{
...
this._hScrollBar = base.GetTemplateChild("HorizontalScrollbar") as ScrollBar;
if (this._hScrollBar != null)
{
this._hScrollBar.IsTabStop = false;
this._hScrollBar.Maximum = 0.0;
this._hScrollBar.Orientation = Orientation.Horizontal;
this._hScrollBar.Visibility = Visibility.Collapsed;
this._hScrollBar.Scroll += new ScrollEventHandler(this.HorizontalScrollBar_Scroll);
}
...
this._vScrollBar = base.GetTemplateChild("VerticalScrollbar") as ScrollBar;
if (this._vScrollBar != null)
{
this._vScrollBar.IsTabStop = false;
this._vScrollBar.Maximum = 0.0;
this._vScrollBar.Orientation = Orientation.Vertical;
this._vScrollBar.Visibility = Visibility.Collapsed;
this._vScrollBar.Scroll += new ScrollEventHandler(this.VerticalScrollBar_Scroll);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment