Template="#Crow.Templates.ArrowButTemplate.crow">
<Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/>
</Button>
- <Slider Name="Slider" Value="{../../../Scroll}" Maximum="{../../../MaximumScroll}"
+ <Slider Name="Slider"
+ Orientation="{../../../Orientation}"
+ Value="{../../../Value}"
+ Maximum="{../../../Maximum}"
+ LargeIncrement="{../../../LargeIncrement}"
+ SmallIncrement="{../../../SmallIncrement}"
Background="hgradient|0:DimGray|0,1:Gray|0,95:Gray|1:White"
- Width="{../../../TemplatedWidth}" Height="{../../../TemplatedHeight}" Orientation="{../../../Orientation}"
+ Width="{../../../TemplatedWidth}" Height="{../../../TemplatedHeight}"
ValueChanged="../../../onSliderValueChange"/>
<Button MouseRepeat="true" Width="12" Height="12" MouseClick="../../../onScrollForth"
Template="#Crow.Templates.ArrowButTemplate.crow">
<Border BorderWidth="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
<HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
<Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"
- Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
+ Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}">
<VerticalStack Width="{../../../../TemplatedWidth}" Height="-1"
Name="List" Margin="0" VerticalAlignment="Top" />
</Scroller>
- <ScrollBar Name="scrollbar1" Scroll="{../scroller1.ScrollY}"
- MaximumScroll="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
Width="10" Height="{../../../TemplatedHeight}" />
</HorizontalStack>
</Border>
\ No newline at end of file
int frameCpt = 0;
int idx = 0;
string[] testFiles = {
+ "testScrollbar.goml",
"4.crow",
"testColorList.crow",
"testGroupBox.goml",
"testTextBox.crow",
"testImage.crow",
"test4.goml",
- "testScrollbar.goml",
"2.crow",
"test1.goml",
"testWindow2.goml",
<Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
<HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" >
<Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"
- Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
+ Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}">
<VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" MinimumSize="100;100"
Name="List" Margin="0" VerticalAlignment="Top" />
</Scroller>
- <ScrollBar Name="scrollbar1" Scroll="{../scroller1.ScrollY}"
- MaximumScroll="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
Width="14" Height="{../../../TemplatedHeight}" />
</HorizontalStack>
</Border>
<?xml version="1.0"?>
<Group Name="TopContainer" Width="400" Height="400"
Focusable="True" Background="Gray">
- <ScrollBar Height="0" Orientation="Vertical" Width="16" MaximumScroll="100"/>
+ <ScrollBar Height="0" Orientation="Vertical" Width="16" Maximum="100"/>
</Group>
\ No newline at end of file
namespace Crow
{
[DefaultTemplate("#Crow.Templates.ScrollBar.goml")]
- public class ScrollBar : TemplatedControl
+ public class ScrollBar : NumericControl
{
Orientation _orientation;
- Slider _slider;
- double _maximumScroll;
- double _scroll;
- public ScrollBar() : base()
- {
- }
-
- protected override void loadTemplate(GraphicObject template = null)
- {
- base.loadTemplate (template);
- _slider = this.child.FindByName ("Slider") as Slider;
- }
+ #region CTOR
+ public ScrollBar() : base() {}
+ #endregion
[XmlAttributeAttribute()][DefaultValue(0.0)]
- public virtual double MaximumScroll
- {
- get { return _maximumScroll; }
- set {
- if (_maximumScroll == value)
- return;
- _maximumScroll = value;
- registerForGraphicUpdate ();
- NotifyValueChanged ("MaximumScroll", _maximumScroll);
- }
- }
- [XmlAttributeAttribute()][DefaultValue(0.0)]
- public virtual double Scroll
- {
- get { return _scroll; }
- set {
- if (_scroll == value)
- return;
- _scroll = value;
- if (_scroll < 0.0)
- _scroll = 0.0;
- else if (_scroll > _maximumScroll)
- _scroll = _maximumScroll;
- registerForGraphicUpdate ();
- NotifyValueChanged ("Scroll", _scroll);
- }
+ public override double Maximum {
+ get { return base.Maximum; }
+ set { base.Maximum = value; }
}
[XmlAttributeAttribute()][DefaultValue(Orientation.Vertical)]
public virtual Orientation Orientation
}
public void onScrollBack (object sender, MouseButtonEventArgs e)
{
- Scroll -= 50;
+ Value -= SmallIncrement;
}
public void onScrollForth (object sender, MouseButtonEventArgs e)
{
- Scroll += 50;
-
+ Value += SmallIncrement;
}
public void onSliderValueChange(object sender, ValueChangeEventArgs e){
if (e.MemberName == "Value")
- Scroll = Convert.ToDouble(e.NewValue);
+ Value = Convert.ToDouble(e.NewValue);
}
}
}