halkar / xamarin-range-slider Goto Github PK
View Code? Open in Web Editor NEWRange slider for Xamarin and Xamarin.Forms
Home Page: https://www.nuget.org/packages/Xamarin.Forms.RangeSlider/
License: MIT License
Range slider for Xamarin and Xamarin.Forms
Home Page: https://www.nuget.org/packages/Xamarin.Forms.RangeSlider/
License: MIT License
Could not install package 'Xamarin.RangeSlider 0.5.7'.
You are trying to install this package into a project that targets
'.NETPortable,Version=v4.5,Profile=Profile78', but the package
does not contain any assembly references or content files that
are compatible with that framework. For more information,
contact the package author.
I believe that should not be a problem to provide PCL assembly for Xamarin.RangeSlider.Forms
I'm using the nuget package on Xamarin iOS and I've added a Range Slider Control to one of my View Controller in the storyboard. Each time I have to change the view controller containing the slider, the designer file of my view is changed and write:
[GeneratedCode ("iOS Designer", "1.0")] Xamarin.RangeSlider.RangeSeekBar MyRange { get; set; }
This cause the error "Xamarin.RangeSlider.RangeSeekBar is inaccessible due to its protection level". To fix the problem, I have to change the "RangeSeekBar" to "RangeSliderControl" in the designer file, but I need to do this everything the designer is changed.
Is there any fix for this?
Thanks.
Issue 1.
The control is really nice but I have some issues. On android if you put this control in the detail of a master detail page it works all fine. This is because you have to slide open the menu from the left side. On IOS however you can slide open the master menu from any place in the screen by swiping to the right. So if you swipe the slider to the right it will move a small portion. Then it locks and the menu starts appearing and moving to the right. It seems that the swiping gesture of the menu has preference above the swiping on your control and this is wrong. With a normal slider in the detail it does work fine though.
Issue 2.
I need one slider but I want the number above the slider. So I show the number above and hide the min thumb. The min thumb is hidden but the number above it is still visible in IOS. I would expect that if you hide a thumb the number above it is hidden too.
Could not install package 'Xamarin.RangeSlider 0.5.7'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Please repro with the previously submitted project
Make the Windows 8.1. project the current project and build. You will get these build errors:
The type or namespace name 'ExportRendererAttribute' does not exist in the namespace 'Xamarin.Forms' (are you missing an assembly reference?)
The type or namespace name 'ExportRenderer' does not exist in the namespace 'Xamarin.Forms' (are you missing an assembly reference?)
BR PV
Currently we have a TextFormat
property, it would be great to have extra optional LowerTextFormat
and UpperTextFormat
ones.
For example, I'd want to treat maximum upper value as unlimited and display "Unlimited" label when upper handler is at right most position.
Hi,
I'm currently using this slider in my app, and moving the slider rapidly seems to crash the iOS version of the app. The android version is fine.
The crash seems to occur when the values get set in the element,
public void OnLowerValueChanged(float value)
{
LowerValue = value;
LowerValueChanged?.Invoke(this, EventArgs.Empty);
}
public void OnUpperValueChanged(float value)
{
UpperValue = value;
UpperValueChanged?.Invoke(this, EventArgs.Empty);
}
If I comment out the assignment,
public void OnLowerValueChanged(float value)
{
//LowerValue = value;
LowerValueChanged?.Invoke(this, EventArgs.Empty);
}
public void OnUpperValueChanged(float value)
{
//UpperValue = value;
UpperValueChanged?.Invoke(this, EventArgs.Empty);
}
it doesn't crash, but the labels don't get updated.
Any help with this will be greatly appreciated.
Typically sliders would have an increment setting so that you can force increments of a defined amount. I.e. the selection would jump by a step value e.g. value of 25. Therefore a min value of 100 and max value of 200 would have 5 steps in total... 100, 125, 150, 175, 200.
The control is currently useless, since the system will not work with Minimum values greater than 0. Say the minimum value property is 40 and you set the Lower value to 50, the reading is set to 90, not 50, since 90 = 40 + 50.
This is not true for the UpperValue, in which case it would be consistent, at least. You can see this behavior in the attached project. It simply defines a page with a slider on it, and sets up a trivial Viewmodel, does two way binding to it.
I hope this is enough to fix the problem.
Hi,
I meet a problem when using it.
In UWP, when the page appearing, if the lower value is not equal to the minvalue, the upper value is always equal to the lower value.
Firstly I thought there was something wrong when binding, but then I try this:
<forms:RangeSlider Grid.Row="0"
ShowTextAboveThumbs="True" MinimumValue="0" MaximumValue="100"
LowerValue="50"
UpperValue="75" >
Both LowerValue and UpperValue are set as 50 when the page is appearing.
Only in UWP.
Can you help me on this?
Thank you.
Is it possible to modify the text color above the thumbs?
That event or UpperValueChanged isn't called on UWP (Android works). It's straight forward, you should reproduce this bug easy.
Hi,
tried to run an app using your Range-Slider on an iPhone today. Unfortunately caused the package an error at runtime:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Xamarin.Forms.Xaml.XamlParseException: Position 110:10. Type forms:RangeSlider not found in xmlns clr-namespace:Xamarin.RangeSlider.Forms;assembly=Xamarin.RangeSlider.Forms\n at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode) [0x00040]
Namespace declaration:
xmlns:forms="clr-namespace:Xamarin.RangeSlider.Forms;assembly=Xamarin.RangeSlider.Forms"
Used the latest version 0.6.4 of the Xamarin.Forms.RangeSlider and Xamarin.RangeSlider.
Can you use the RangeSlider on an iOS device? Do I need to add the ExportRendererAttribute to my iOS AppDelegate class, like in your example?
Thanks for your help
Hello,
could be nice to have a circular slider,
do you think will be possibile in next releases?
Thanks
Hi,
Getting below error
Xamarin caused by: android.runtime.JavaProxyThrowable: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Android.Graphics.RectF'.
Java.Interop.JniPeerMembers.AssertSelf(IJavaPeerable self)<283b4b1e03f54fee85a79f83eb627def>:0
Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(string encodedMember, IJavaPeerable self, JniArgumentValue* parameters)<283b4b1e03f54fee85a79f83eb627def>:0
Android.Graphics.RectF.Set(float left, float top, float right, float bottom):0
RangeSlider.RangeSliderView.OnDraw(Canvas canvas):0
Android.Views.View.n_OnDraw_Landroid_graphics_Canvas_(IntPtr jnienv, IntPtr native__this, IntPtr native_canvas):0
at (wrapper dynamic-method) System.Object:85810f79-2a65-4a16-aa84-6fa1c465f516 (intptr,intptr,intptr)
md567636376cf6977936eff72a239369451.RangeSliderView.n_onDraw(Native Method)
md567636376cf6977936eff72a239369451.RangeSliderView.onDraw()RangeSliderView.java:72
In the file Xamarin.RangeSlider.Forms.WinRT.Shared\RangeSeekBarRenderer.cs Line: 25 in method OnElementChanged causes an exception when the RangeSlider gets unloaded. The property Element is NULL.
Hi.
How can i show min and max value labes when RangeSlider are shown for the first time and min and max values is selected?
Setting the UpperValue and LowerValue programmatically after the View is appeared does not update the control until it receives a touch event in the View area.
In my XIB I have a UIView where I set the class to RangeSlider
and setting initial values, works great! Strange issue is after the View appears I set the LowerValue and UpperValue programmatically again but nothing happens until the RangeSlider receives a touch event, just by tap on the view it moves the slider knobs according to what I set it to.
Any idea?
Having installed Xamarin.RangeSlider 0.2.0 into my Xamarin Droid project (Xamarin.RangeSlider.Droid) I can't see properties such as 'DefaultColor', 'ShowLabels', 'ThumbImage' etc. in intellisense. Looking at Xamarin.RangeSlider.Droid in the Assembly Browser and the RangeSliderControl class doesn't seem to match the latest code here on GitHub. The only public property seems to be 'NotifyWhileDragging'.
I have also tried version 0.1.6 and this too seems to be the same older version?
I have downloaded and built latest and all works fine so it does seem as the Nuget packages are using older versions of code/assemblies.
Please reuse the repro project I submitted for a previous problem.
When running the form with UWP an exception is thrown:
Could not load file or assembly 'System.Runtime.WindowsRuntime.UI.Xaml, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
rendering the control unfunctional.
Hi,
how is it possible to change the color of the thumb using a PlatformEffect on Android and iOS?
For the normal Slider (Android SeekBar; iOS UISlider) it is very simple:
https://blog.xamarin.com/customizing-xamarin-forms-controls-with-effects/
Changing the ActiveColor of the RangeSlider is also easy but the thumb of the RangeSlider is a Bitmap and not a Drawable. Do you have a suggestion how the color of the Thumb can be easily changed?
Thank you
The entire component is gone. Works in Android.
Running latest version of the slider.
Hi, this is an improvement request. For now, with the textFormat, it is possible the use "C" to specify currency, but we cannot specify which culture to use (e.g. american dollar, canadian dollar, etc.) It would be great to have a field to specify which culture to use in the format :)
Thanks!
I use the code below to display the range slider, but except the background color (pink, as set) I can not see any elements on that slider.
var ageSlider = new RangeSlider
{
MinimumValue = 17,
MaximumValue = 70,
LowerValue = 1,
UpperValue = 70,
ShowTextAboveThumbs = true,
StepValue = 1,
HeightRequest = 80,
BackgroundColor = Color.Pink
};
I see that the images are inside the "Resources" folder, but my app uses "Images" folder, however, I think that this does not explain why the textfields are not visible...
Any ideas on this issue?
Thickness of slider's line.
I set vector drawable for thumb, normal, pressed, disabled a XML drawable.
I want to use my shapes, maybe vectorDrawable.
var thumbNormal = Resource.Drawable.thumb_normal;
drawable/thumb_normal.xml :
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#bada55"/> <stroke android:width="10dp" android:color="#fff" /> <corners android:radius="10dp"/> <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> </shape>
Error when i open activity widh slider:
System.NullReferenceException: Object reference not set to an instance of an object.
I tried to bind the values to the lower value and the upper value but the lower value is not shown the right value. My model have 5 as lower value but the range slider will display 4. The upper value seems fine though.
Hi Artur,
I am facing a issue like "showLabels" already defined when I am trying to build the application in android. I am using telerik dlls in my application to create some charts and your RangeSlider to select a time period. Now inside "attr.xaml" there is a attribute named "showLabels", which is making a issue for me. Need your help sir.
Hi,
I am getting following error:
"Attribute Showlabel" is already been defined.
I am using telerik in my project and whenever I add Range slider in my package and compile the project I get the above mentioned error for android.
Can you please help me in resolving the issue.
Regards,
Nisha
Hello,
I tried to build the Xamarin.Forms Droid sample but it didn't work.
I get some errors in the "values.xml" file, as we can see in this screenshot.
Would you have any explanation? For iOS and UWP I get no problem...
LowerValueChanged
and UpperValueChanged
events are not fired, if NotifyWhileDragging
is false
.
The probable cause of it relies in OnTouchEvent
's MotionEventActions.Up
case, where _pressedThumb
is set to null
, before the checks on events, so they will be never raised.
The mentioned code piece:
_pressedThumb = null;
Invalidate();
if (_pressedThumb == Thumb.Min)
OnLowerValueChanged();
if (_pressedThumb == Thumb.Max)
OnUpperValueChanged();
If possible only set _pressedThumb
to null
after the events where checked and fired.
The windows phone version of the rangeslider does not render. Repro: Build a simple page with a range slider (you may repro with the sample I already provided for another problem). The WP screen will be blank, and not show a range slider.
I suspect the problem is that the correct assemblies are not installed as part of the nuget install. I only see references to:
xamarin.rangeslider.common
xamarin.rangeslider..Forms
in the windows phone project, whereas the Droid version in addition references
xamarin.rangeslider.Droid
xamarin.rangeslider.Forms.Droid
in which the renderer is contained.
After Add Xamarin.RangeSlider to Xamarin.Android project, i have problem with copilate realese version (Link SDK Assemblies):
Severity Code Description Project File Line Suppression State
Error The "LinkAssemblies" task failed unexpectedly.
Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Android.Graphics.Color Android.Content.Res.Resources::GetColor(System.Int32,Android.Content.Res.Resources/Theme)' (defined in 'Xamarin.RangeSlider.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.RangeSlider.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Graphics.Color Android.Content.Res.Resources::GetColor(System.Int32,Android.Content.Res.Resources/Theme)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
--- End of inner exception stack trace ---
at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() Samson_Lenses.Droid
Can you help me?
A couple of things that would be really useful (commonly so).
Anything you could do to implement the above would be massively appreciated?!... I await you feedback. ย ๐๐ผ
Is there a way to change the hair line color that I can't see?
The Xamarin.Forms.RangeSlider package causes compiler warnings in VisualStudio 2015 when using it in an UWP-App:
Warning: Detected package downgrade: Xamarin.Forms from 0.0.0 to 2.3.3.175
App.UWP (>= 1.0.0) -> Xamarin.Forms.RangeSlider (>= 0.6.8) -> Xamarin.Forms
App.UWP (>= 1.0.0) -> Xamarin.Forms (>= 2.3.3.175)
Hi, I'm using the Xamarin nuget package on Android and iOS (not Forms). I want a slider with a step value of 10 going from 0 to 100 and I want to be able to freely changed the value of the slider and the snap to step value occurs only when I let go.
On Android, it is working nicely, but I have trouble on iOS. Even without step value, the slider control is "jittering", it is hardly moving freely and always stops in the movement, I wonder why is that?
When using the step value, I can stop between two steps too... This is how I set up the slider:
Slider.MinimumValue = 0.0f; Slider.MaximumValue = 100.0f; Slider.ShowTextAboveThumbs = true; Slider.StepVAlue = 10.0f; Slider.StepValueContinuously = false;
Do you have any ideas what is causing these problems on iOS?
Thanks for your help!
After creating a new Universal Single View Xamarin.iOS app project on Visual Studio 2015, I installed RangeSliderControl using the nuget package.
I was able to drag the control from the toolbox to the storyboard and configure all settings.
When I try to run the project, I get this message: "Unknown class RangeSlider in Interface Builder file". The component does not show on the emulator when running the app.
Is there any extra step to use it via interface builder?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.