I want to set size of change after use one from two buttons connected with NumericUpDown control.
I have something like this:
<toolkit:NumericUpDown Grid.Column="1" Minimum="2" ValueFormat="F0" Value="4" LargeChange="1" Maximum="10"/>
In WPF's NumericUpDown is property "increment", but I this I can't find. I think that it can be LargeChange, but it not working for me. I want to set increment = 1.
In example increment is 0,1
Thanks
Set the SmallChange to 1. This will result in the change of 1 every time you increment the value.
<toolkit:NumericUpDown ValueFormat="F0" Value="4" SmallChange="1" Maximum="10" />
Related
I'm trying to set up a SciChart VerticalLineAnnotation similar to the Drag Horizontal Threshold example in the SciChart example suite. I have the annotation bound to a property in my view model, but when dragging the annotation it continually sets the property to a value of 0.
I've tried setting the property value in code and it does move the line as you would expect indicating the binding is fine. I set a breakpoint on the property and confirmed the 0 value is coming from the control, not my code.
<sc:SciChartSurface x:Name="OverviewSurface"
Margin="5,2,5,2"
Background="White"
Grid.Row="2"
Grid.ColumnSpan="4"
Loaded="OnOverviewSurfaceLoaded"
RenderableSeries="{Binding ElementName=ChartSurface, Path=RenderableSeries}"
YAxes="{sc:AxesBinding YAxes}">
<sc:SciChartSurface.XAxis>
<sc:NumericAxis VisibleRange="{Binding VisibleRange}" DrawMajorGridLines="False" DrawMinorGridLines="False" DrawMajorBands="False" Visibility="Collapsed"/>
</sc:SciChartSurface.XAxis>
<sc:SciChartSurface.Annotations>
<sc:VerticalLineAnnotation VerticalAlignment="Stretch"
IsEditable="True"
ShowLabel="False"
Stroke="#FF42b649"
StrokeThickness="4"
YAxisId="ChannelA"
X1="{Binding SelectedIndex, Mode=TwoWay}" />
</sc:SciChartSurface.Annotations>
</sc:SciChartSurface>
I expect that when I drag the Annotation along the horizontal length of the chart that I will get a value corresponding with the X position placed in SelectedIndex, but all I ever get is zero.
The cause of this issue turned out to be the data type of SelectedIndex, which was an unsigned integer. Despite the fact that VerticalLineAnnotation's X/Y value type is IComparable, if you are using the IsEditable="True" function, the drag step size is fractional and if bound to an integer type, it will continually round to 0 making it incapable of movement.
If there is a way to change the step size of the drag in SciChart, I was unable to locate it. Instead I changed SelectedIndex to a double and rounded it to my desired unsigned integer in the setter, which solved my problem.
How can I change the style of a progressbar in WPF?
On Windows 10 it's a straight bar, but in win 7 it's splitted in many small blocks. I want to have the bar straight as on win 10, when the application is used on win 7
I just lookng for a property like 'ugly-block-spacing' which I can set. Or do I have really define the whole style new?
Yes, I am afraid you will have to re-define the entire ControlTemplate from scratch. You cannot override only a part of a ControlTemplate:
WPF: Is there a way to override part of a ControlTemplate without redefining the whole style?
But you could copy the default ControlTemplate by right-clicking on a ProgressBar in design mode in Visual Studio on a Windows 10 computer, edit it as per your requirements and then use style i your application instead of the default one.
Progressbar has a property called Style, you could set it to your liking.
If you give Metro a try, you could use somthing like this:
<metro:MetroProgressBar x:Name="pbar" Value="50" Height="20"></metro:MetroProgressBar>
If you want to use the normal bar with Metro Style:
<ProgressBar x:Name="pbar" Value="50" Height="20" Style="{StaticResource MetroProgressBar}"></ProgressBar>
Same without Style:
<ProgressBar x:Name="pbar" Value="60" Height="20" Style="{x:Null}"></ProgressBar>
If you want to know more about Metro, you can find it here
I do not manage to properly set the width of my XAML ToggleSwitch.
My code is as follows:
<Controls:ToggleSwitch OnLabel="True"
OffLabel="False"
IsEnabled="{Binding CheckValueEnable}"
IsChecked="{Binding CheckValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="250" >
</Controls:ToggleSwitch>
Whatever Width value I set, there is a too big spacing between the text (true / false) and the visual toggle button.
How can I decrease this spacing?
I would guess your issue (over exaggerated a little) is something like this:
{O }___________True
What you want is:
{O }__True
Without knowing the control it is a bit difficult but i would guess you only option is to modify the ToggleSwitch's ControlTemplate to define the content presenter position
EDIT:
Further to that, you might find the following article useful as it describes the process of editing controls in XAML
http://docs.telerik.com/devtools/wpf/styling-and-appearance/styling-apperance-editing-control-templates
<TextBlock Text="{Binding Amount}" />
I have this text block, it simply shows a number what ever I bind.
What I want is that it could append 'AED' before the bindings. Mean if 4.00 is bound, it would show this:
AED 4.00
If I don't want to create another textblock and use it for AED and don't want to change the value of binding to 'AED 4.00' from '4.00', then is there a way to do this kind of thing ?
You should implement IValueConverter and use it in your XAML for converting the double value to string.Format("AED {0}", value);
Take a look at this sample
For WPF applications use this:
Simply put a StringFormat to the Binding
<TextBlock Text="{Binding Amount, StringFormat=AED {0}}" />
I am trying to use the ProgressBar as a representation of a percent value (I have not found an alternative control that looks right).
I am trying to set the value. It is my understanding that just setting the Value property should work, and update the control when my current event handler ends and control passes back to the UI.But no matter what I set the value to, the bar stays empty.
Here is my XAML:
<ProgressBar Name="LevelProgress" Maximum="100" Minimum="0" />
and my C#:
LevelProgress.Value = 43.0;
I have also tried:
LevelProgress.SetValue(ProgressBar.ValueProperty,43.0);
Even setting the Value property in the XAML definition does not work.
I really don't want to have to setup some big background thread thing just to set this value. Can anyone recommend a solution, or an alternative control?
Works for me
Do you
InitializeComponent();
Before?
LevelProgress.Value = 43.0;
I put it in the Loaded event and it worked there.
And I tried
<ProgressBar Name="LevelProgress" Maximum="100" Minimum="0" Value="43" />
And it works there. Something is wrong with the progress bar.