03-05-2014 10:56 AM
Hi,
does anyone know how to change a the Style of the standart Slider ? For example i want another scrollbar and another scroll-color.
Thanks
Manuel
03-06-2014 11:05 AM
If by "standard Slider" you mean the Microsoft Slider control, I would start with the Slider Styles and Templates page on MSDN.
If instead you mean the Measurement Studio Slider<TData> control, I will need to know more about what you mean by "another scrollbar and another scroll-color" to help.
03-12-2014 10:08 AM
Hi Paul,
sorry for my late Answer. I mean the Measurement Studio SliderDouble.
I have an Example.
My Slider looks like
And the Thumb in my Slider looks like
But i want that my Slider or only my Thumb looks like the following One
Is this possible ?
03-12-2014 01:00 PM
If all you need is a different visual for the pointer, you can use the PointerTemplate property:
<ni:SliderDouble Height="200" Width="40" ScaleLocation="Far" Orientation="Vertical">
<ni:SliderDouble.PointerTemplate>
<DataTemplate>
<Grid niPrimitives:RegionPanel.RelativeHeight="1.0"
niPrimitives:RegionPanel.RelativeHorizontalPosition="{Binding RelativeValue}"
niPrimitives:RegionPanel.RelativeHorizontalAlignment="Center"
niPrimitives:RegionPanel.LayoutOptions="ExcludeOverhang"
MinWidth="11">
<Path Data="M 1,0 L 2,1 2,2 0,2 0,1 Z"
Stretch="Fill"
Fill="{Binding PointerBrush}"
Stroke="{BindingBorderBrush}"
StrokeThickness="1" />
</Grid>
</DataTemplate>
</ni:SliderDouble.PointerTemplate>
</ni:SliderDouble>
Please note that this mockup relies on implementation details of the current release of the WPF controls. We intentionally left many of the underlying primitive types with minimal documentation, as we may change them in the future. In the current implementation, we use RegionPanels to perform the layout for many of our controls. Although these exact members may be removed in a later release, we do plan to provide equivalent functionality and stabilize the primitive API over time.
Besides that caveat, I hope you find this useful.
03-13-2014 02:11 AM
Thank you Paul, that helped me a lot.
I've one more Question. I'm not sure if i should open a new Thread.
I have a slider with 12 Values. But i want to change the Size and not all Values shows up. How can i change the distance between the Values so that all Values shows up ?
03-13-2014 10:36 AM
For future reference, it would be more useful for tracking purposes to open a separate thread.
The answer to your question is simple, though: the Mode property on the MajorDivisions for the scale controls which values are displayed. For example, using an interval mode will force all the whole numbers in the range to be displayed:
<ni:SliderDouble Range="1, 12, System.Double" >
<ni:SliderDouble.Scale>
<ni:NumericScale>
<ni:NumericScale.MajorDivisions>
<ni:RangeLabeledDivisions Mode="Interval: 0, 1" />
</ni:NumericScale.MajorDivisions>
</ni:NumericScale>
</ni:SliderDouble.Scale>
</ni:SliderDouble>
03-13-2014 10:58 AM
Great, that was exactly what i need.
Thanks a lot.
Manuel