I have a slider in a Xamarin Forms app that I'm trying to change the color of the thumb and the slider bar. In Android it was easy to override this in a renderer, but in iOS it looks like all I can do is change the thumb image. Is it possible to change the bar color? Thanks!
You can use the TintColor:
var slider = new UISlider(View.Frame);
slider.ThumbTintColor = UIColor.Blue;
slider.MinimumTrackTintColor = UIColor.Red;
slider.MaximumTrackTintColor = UIColor.Green;
I also just found a new plugin that does all of that and a lot more. It will probably be overkill for just that but if you plan to do a lot more custom stuff to controls it might be helpful.
I have not tried it myself but I looking forward to using it soon.
XF Gloss
Related
In my custom NavigationRender, I need an image as background of navigation bar.
I use this line to do that:
this.NavigationBar.BarTintColor = UIColor.FromPatternImage(UIImage.FromFile("myImmage"));
this.NavigationBar.Translucent = false;
It works, but image appear lighter than the original one due to a blur efefct added on navigation.
Is there a way to avoid it?
In my Xamarin.IOS visual studio project, I wanted to use Vector pdf image in an UIImageView. But I am not able to add the vector image directly in the storyboard designer (also tried drag-drop).
Is there a way to use Vector pdf image in xamarin IOS?
Any sample would be much helpful.
Thanks.
Yes, As lowleetak said, We need to add the pdf file into the asset first.
Xamarin tutorial here , just follow the step ,it's simple.
Edit:
there is no option to select the Attributes Inspector for setting the Scales to Single Vector in Visual Studio. Is there an alternative for this?
AFAIK,there is no option to set the scale for the vector , maybe you could set this property when generate the pdf file.
I want to handle click event to capture the image X Y co-ordinates in C#. Is there a way to do this?
Override the touch event . documentation here.
Code :
public override void TouchesBegan(NSSet touches, UIEvent evt)
{
var touch = touches.AnyObject as UITouch;
CGPoint point = touch.GetPreciseLocation(yourImage);
}
Update:
On iPhone5:
On iPhone6
And this are the constraints
You will need to add the pdf images to asset catalog first (Images.xcassets). You can refer to the guide HERE. It is a guide for Xcode but should be quite the same in Visual Studio.
I want to avoid horizontal wrapping in CARTO Xamarin Mobile SDK.
"Avoid horizontal wrapping" means something like OpenLayers 3's wrapX = false.
Are there any attributes or functions?
I found it by myself.
MapView.Options.SeamlessPanning = false;
You can find this here:
http://cartodb.github.io/mobile-android-samples/com/carto/components/Options.html#setSeamlessPanning-boolean-
I am using Xcode 6.4 and find the canvas/background colour of the interface builder to be terrible. ViewControllers have a general whitish colour, so does the canvas. It makes viewing rather uncomfortable as there is no contrast between the canvas and the objects I work with (view controllers etc). Is there any way I could change the canvas colour please?
As far as my research into this went, there is no way to change the canvas colour.
UPDATE
There seems to indeed be a way to do this (thanks to deej): here is a link
I need to know, which is the best way to blur the background of the Windows Phone 7 app to concentrate the user's attention on a "always on top" popup window.
My idea is:
Make an in-memory screenshot of the background grid (by turning it into a freezable or something).
Add an image that overlaps the background grid, but is below (with the z-index) the popup.
Still I doubt I will be able to overlap the application bar.
At this point, if you have a solution, please advise.
A few pointers for you ...
Unfortunately the Silverlight BlurEffect and other Bitmap effects didn't make it into Window Phone 7, so you will have to implement the blur yourself. This is actually pretty simple, just use a Gaussian Convolution Filter.
To achieve this effect you can capture the visuals of your application into a WriteableBitmap, manipulate the image to create your blur, then overlay this image over your application using a PopUp. I did something similar in a blog post I wrote about fly-out text animations here:
http://www.scottlogic.co.uk/blog/colin/2011/04/metro-in-motion-3-flying-titles/
Find your root visual as follows:
var rootElement = Application.Current.RootVisual as FrameworkElement;
Add a copy of this UI into a popup as follows:
_backgroundMask = new Rectangle()
{
Fill = new SolidColorBrush(Colors.Black),
Opacity = 0.0,
Width = rootElement.ActualWidth,
Height = rootElement.ActualHeight
};
_popupCanvas.Children.Add(_backgroundMask);
_targetElementClone = new Image()
{
Source = new WriteableBitmap(element, null)
};
_popupCanvas.Children.Add(_targetElementClone);
And show it:
_popup.IsOpen = true;
I'll leave you to work out how to blur the background!
As an aside, your will not be able to overlay or capture the application bar visuals. Hide it before performing this transformation.
Finally, blurring the background isn't really very 'Metro'. Are you sure you want to do this?
Instead of blurring just use a semi transparent layer over the top of the page.
You should hide the application bar before trying to create such an effect as you won't be able to place anything on top of it.