Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RangeSlider #574

Open
wants to merge 4 commits into
base: 2.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions samples/FASandbox/MainWindow.axaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:uip="using:FluentAvalonia.UI.Controls.Primitives"
xmlns:core="using:FluentAvalonia.Core"
xmlns:sys="using:System"
xmlns:local="using:FASandbox"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="FASandbox.MainWindow"
Title="FASandbox">
<Window x:Class="FASandbox.MainWindow" xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="using:FluentAvalonia.Core" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:FASandbox" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sys="using:System" xmlns:ui="using:FluentAvalonia.UI.Controls" xmlns:uip="using:FluentAvalonia.UI.Controls.Primitives" Title="FASandbox" d:DesignHeight="450" d:DesignWidth="800" x:DataType="local:MainWindowViewModel" mc:Ignorable="d">

<StackPanel>
<ui:NumberBox Value="{Binding Min}" />
<ui:NumberBox Value="{Binding Max}" />

<ui:RangeSlider RangeEnd="{Binding Max}" RangeStart="{Binding Min}" />
</StackPanel>

<ToggleSwitch IsChecked="True"/>

</Window>
13 changes: 13 additions & 0 deletions samples/FASandbox/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace FASandbox;

public class MainWindowViewModel : INotifyPropertyChanged
{
private double _min;
private double _max;

public MainWindowViewModel()
{

Expand All @@ -33,6 +36,16 @@ private bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName]str

return false;
}

public double Min
{
get => _min;
set => RaiseAndSetIfChanged(ref _min, value);
}public double Max
{
get => _max;
set => RaiseAndSetIfChanged(ref _max, value);
}
}

public class Command : ICommand
Expand Down
Loading