本文整理汇总了C#中System.Windows.Controls.Slider类的典型用法代码示例。如果您正苦于以下问题:C# Slider类的具体用法?C# Slider怎么用?C# Slider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Slider类属于System.Windows.Controls命名空间,在下文中一共展示了Slider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachControl
public override bool AttachControl(FilterPropertiesControl control)
{
Control = control;
Grid grid = new Grid();
int rowIndex = 0;
TextBlock brightnessText = new TextBlock();
brightnessText.Text = "Threshold";
Grid.SetRow(brightnessText, rowIndex++);
Slider brightnessSlider = new Slider();
brightnessSlider.Minimum = 0.0;
brightnessSlider.Maximum = 1.0;
brightnessSlider.Value = _colorSwapFilter.Threshold;
brightnessSlider.ValueChanged += brightnessSlider_ValueChanged;
Grid.SetRow(brightnessSlider, rowIndex++);
for (int i = 0; i < rowIndex; ++i)
{
RowDefinition rd = new RowDefinition();
grid.RowDefinitions.Add(rd);
}
grid.Children.Add(brightnessText);
grid.Children.Add(brightnessSlider);
control.ControlsContainer.Children.Add(grid);
return true;
}
示例2: AttachControl
public override bool AttachControl(FilterPropertiesControl control)
{
Control = control;
var grid = new Grid();
int rowIndex = 0;
TextBlock levelText = new TextBlock()
{
Text = "Level"
};
Grid.SetRow(levelText, rowIndex++);
Slider levelSlider = new Slider() { Minimum = 0.0, Maximum = 1.0, Value = _filter.Level};
levelSlider.ValueChanged += levelSlider_ValueChanged;
Grid.SetRow(levelSlider, rowIndex++);
for (int i = 0; i < rowIndex; ++i)
{
RowDefinition rd = new RowDefinition();
grid.RowDefinitions.Add(rd);
}
grid.Children.Add(levelText);
grid.Children.Add(levelSlider);
control.ControlsContainer.Children.Add(grid);
return true;
}
示例3: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.FontSizeSlider = ((System.Windows.Controls.Slider)(target));
return;
case 2:
#line 10 "..\..\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ToSmall);
#line default
#line hidden
return;
case 3:
#line 11 "..\..\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ToMiddle);
#line default
#line hidden
return;
case 4:
#line 12 "..\..\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ToLarge);
#line default
#line hidden
return;
}
this._contentLoaded = true;
}
示例4: setObjects
public void setObjects(Type ShapeType, StackPanel dp)
{
Elements.Clear();
dp.Children.Clear();
if(ShapeType == typeof(GoodStar))
{
dp.Children.Add(new TextBlock() { Text = "Tops Count: " });
// dp.Children.Add(new TextBox() { Name= "topsCount",Width = 30 });
Slider tops = new Slider() { Name = "topsCount", Value =5, Minimum = 1, Maximum = 30, SmallChange = 1, LargeChange = 1, Width = 100 };
tops.ValueChanged += tops_ValueChanged;
dp.Children.Add(tops);
dp.Children.Add(new TextBlock() { Text = "Coeficient: " });
Slider coef = new Slider() { Name = "Coefficient",Value = 0.5, Minimum = 0.01, Maximum = 1, SmallChange = 0.01, LargeChange = 0.1, Width = 100 };
coef.ValueChanged += coef_ValueChanged;
dp.Children.Add(coef);
}
if(ShapeType == typeof(GoodPolygon))
{
dp.Children.Add(new TextBlock() { Name= "topsCount", Text = "Tops Count: " });
Slider tops = new Slider() { Name = "topsCount", Value = 5, Minimum = 1, Maximum = 30, SmallChange = 1, LargeChange = 1, Width = 100 };
tops.ValueChanged += tops_ValueChanged;
dp.Children.Add(tops);
}
if(ShapeType == typeof(GoodRectangle))
{
dp.Children.Add(new TextBlock() { Text = "X radius: " });
Slider xRadius = new Slider() { Name = "xRadius", Value = 0, Minimum = 0, Maximum = 90, SmallChange = 1, LargeChange = 1, Width = 100 };
xRadius.ValueChanged += Angle_ValueChanged;
dp.Children.Add(xRadius);
dp.Children.Add(new TextBlock() { Text = "Y radius: " });
Slider yRadius = new Slider() { Name = "yRadius", Value = 0, Minimum = 0, Maximum = 90, SmallChange = 1, LargeChange = 1, Width = 100 };
yRadius.ValueChanged += Angle_ValueChanged;
dp.Children.Add(yRadius);
}
}
示例5: SliderExtensions
private SliderExtensions(Slider attachedObject)
{
this.element = attachedObject as Slider;
this.element.AddHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(element_MouseLeftButtonDown), true);
this.element.MouseMove += new MouseEventHandler(element_MouseMove);
this.element.MouseLeftButtonUp += new MouseButtonEventHandler(element_MouseLeftButtonUp);
}
示例6: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
this.sliderElement = base.GetTemplateChild("ZoomSlider") as Slider;
this.zoomInElement = base.GetTemplateChild("ZoomInElement") as RepeatButton;
this.zoomOutElement = base.GetTemplateChild("ZoomOutElement") as RepeatButton;
this.SetupZoom();
if (this.sliderElement != null)
{
sliderElement.MouseEnter += new MouseEventHandler(zoomSliderElement_MouseEnter);
sliderElement.MouseLeave += new MouseEventHandler(zoomSliderElement_MouseLeave);
this.sliderElement.ValueChanged += new RoutedPropertyChangedEventHandler<double>(this.ZoomSlider_ValueChanged);
}
if (this.zoomInElement != null)
{
this.zoomInElement.Click += new RoutedEventHandler(this.ZoomInButton_Click);
}
if (this.zoomOutElement != null)
{
this.zoomOutElement.Click += new RoutedEventHandler(this.ZoomOutButton_Click);
}
}
示例7: Creation
public void Creation ()
{
Slider p = new Slider ();
p.Measure (new Size (double.PositiveInfinity, double.PositiveInfinity));
Assert.AreEqual (p.DesiredSize.Width, 0, "DesiredSize.Width");
Assert.AreEqual (p.DesiredSize.Height, 0, "DesiredSize.Height");
}
示例8: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
m_panelOffscreenOffsetX = DefaultOffscreenOffsetX;
m_floorSlider = GetTemplateChild("FloorSlider") as Slider;
m_floorSlider.ValueChanged += OnSliderValueChanged;
m_floorSlider.ApplyTemplate();
m_sliderTickBar = GetTickBar(m_floorSlider);
var sliderThumb = GetThumb(m_floorSlider);
sliderThumb.DragStarted += OnSliderDragStarted;
sliderThumb.DragCompleted += OnSliderDragCompleted;
m_floorName = (TextBlock)GetTemplateChild("FloorName");
m_dismissButton = (Button)GetTemplateChild("DismissButton");
m_dismissButton.Click += OnClickDismiss;
m_floorPanel = (Grid)GetTemplateChild("FloorPanel");
m_detailsPanel = (Grid)GetTemplateChild("DetailsPanel");
m_detailsPanel.Opacity = 0.0f;
var currentPosition = m_floorPanel.RenderTransform.Transform(new Point(0.0, 0.0));
m_floorPanel.RenderTransform = new TranslateTransform(m_panelOffscreenOffsetX, currentPosition.Y);
}
示例9: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (ScrollViewer == null)
return;
BindedCanvas = f_designerCanvas = ((Canvas)ScrollViewer.Content).Children[0] as Canvas;
f_designerCanvas = ScrollViewer.Content as Canvas;
if (f_designerCanvas == null)
throw new Exception("Canvas must not be null!");
//f_zoomThumb = Template.FindName("PART_ZoomThumb", this) as Thumb;
//if (f_zoomThumb == null)
// throw new Exception("PART_ZoomThumb template is missing!");
f_zoomCanvas = Template.FindName("PART_ZoomCanvas", this) as Canvas;
if (f_zoomCanvas == null)
throw new Exception("PART_ZoomCanvas template is missing!");
f_zoomSlider = Template.FindName("PART_ZoomSlider", this) as Slider;
if (f_zoomSlider == null)
throw new Exception("PART_ZoomSlider template is missing!");
f_designerCanvas.LayoutUpdated += DesignerCanvas_LayoutUpdated;
//f_zoomThumb.DragDelta += Thumb_DragDelta;
f_zoomSlider.ValueChanged += ZoomSlider_ValueChanged;
f_scaleTransform = new ScaleTransform();
f_designerCanvas.LayoutTransform = f_scaleTransform;
}
示例10: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (this.ScrollViewer == null)
return;
this.designerCanvas = this.ScrollViewer.Content as DesignerCanvas;
if (this.designerCanvas == null)
throw new Exception("DesignerCanvas must not be null!");
this.zoomThumb = Template.FindName("PART_ZoomThumb", this) as Thumb;
if (this.zoomThumb == null)
throw new Exception("PART_ZoomThumb template is missing!");
this.zoomCanvas = Template.FindName("PART_ZoomCanvas", this) as Canvas;
if (this.zoomCanvas == null)
throw new Exception("PART_ZoomCanvas template is missing!");
this.zoomSlider = Template.FindName("PART_ZoomSlider", this) as Slider;
if (this.zoomSlider == null)
throw new Exception("PART_ZoomSlider template is missing!");
this.designerCanvas.LayoutUpdated += new EventHandler(this.DesignerCanvas_LayoutUpdated);
this.zoomThumb.DragDelta += new DragDeltaEventHandler(this.Thumb_DragDelta);
this.zoomSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(this.ZoomSlider_ValueChanged);
this.scaleTransform = new ScaleTransform();
this.designerCanvas.LayoutTransform = this.scaleTransform;
}
示例11: ReadOnlyProperties
public void ReadOnlyProperties ()
{
Slider s = new Slider ();
Assert.Throws<InvalidOperationException> (delegate {
s.SetValue (Thumb.IsFocusedProperty, true);
}, "IsFocusedProperty");
}
示例12: ZoomSliderControl
public ZoomSliderControl(BIT.AVL.Silver.Map.Map map)
{
_Map = map;
DefaultStyleKey = typeof(ZoomSliderControl);
if(HtmlPage.IsEnabled)
{
_Thumb = new Thumb();
_Slider = this;
// Slider Events
_Slider.GotFocus += Slider_GotFocus;
_Slider.LostFocus += Slider_LostFocus;
_Slider.ValueChanged += ZoomControl_ValueChanged;
// Map Events
_Map.Events.MapMouseEnter += Events_MapMouseEnter;
_Map.Events.MapMouseLeave += Events_MapMouseLeave;
_Map.Events.MapZoomStarted += Events_MapZoomStarted;
_Map.Events.MapZoomEnded += Events_MapZoomEnded;
_Map.Events.MapZoomChanged += Events_MapZoomChanged;
_Map.Events.MapMouseWheel += Events_MapMouseWheel;
_Map.Events.MapDoubleClick += Events_MapDoubleClick;
_Map.Events.MapTileSourceChanged += Events_MapTileSourceChanged;
SetTileSourceZoomLevels();
_UpdateSlider = true;
}
}
示例13: ColorMixerVIewModel
public ColorMixerVIewModel(Slider red, Slider green, Slider blue)
{
CurrentColor = "Click me";
selector = new Selector(red, green, blue);
clickMeCommand=new ClickMeCommand(selector);
selector.ColorChanged += selector_ColorChanged;
selector.CurrentColor += selector_CurrentColor;
}
示例14: Initialize
public void Initialize (Orientation dir)
{
Widget = new System.Windows.Controls.Slider () {
Orientation = dir == Orientation.Horizontal ? SWC.Orientation.Horizontal : SWC.Orientation.Vertical,
};
Widget.MouseWheel += HandleMouseWheel;
Slider.ValueChanged += ValueChanged;
}
示例15: ApplyDefaultStyle
public void ApplyDefaultStyle ()
{
// Default style is applied when the element is added to the visual tree
Slider s = new Slider ();
Assert.AreEqual (1, s.Maximum, "#1");
TestPanel.Children.Add (s);
Assert.AreEqual (10, s.Maximum, "#2");
}