03-27-2014 11:01 AM
How do I go about changing the ScaleKind programatically in C#? The WPF properties look simple enough but I don't see a way to map this to C# as SkaleKind doesn't appear anywhere in the list of "intellisense" options.
<ni:SliderDouble...
<ni:SliderDouble.Scale>
<ni:NumericScale ScaleKind="Linear"/>
</ni:SliderDouble.Scale>
or
<ni:SliderDouble.Scale>
<ni:NumericScale ScaleKind="LogarithmBase10"/>
</ni:SliderDouble.Scale>
Solved! Go to Solution.
03-27-2014 05:03 PM
If your XAML is setup like your first example, you can give your NumericScale
a name and assign the value directly in code:
XAML
<ni:SliderDouble ...>
<ni:SliderDouble.Scale>
<ni:NumericScale x:Name="scale" ScaleKind="Linear" />
</ni:SliderDouble.Scale>
</ni:SliderDouble>
Code
scale.ScaleKind = RangeScaleKind.LogarithmBase10;
If naming the scale is not an option, then you can cast the Scale
property on the slider to the appropriate type:
var scale = (NumericScale)slider.Scale;
scale.ScaleKind = RangeScaleKind.LogarithmBase10;
03-27-2014 05:50 PM
Thanks again Paul! In C# I am now able to do this:
((NumericScale)slideDemo.Scale).ScaleKind = m_ScaleKind;