Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

Hover Effect is not working properly on button in Xamarin UWP

$
0
0

I tried to add a hover effect for a button.
Following code shows a custom class created in UWP

[assembly: ResolutionGroupName("MyCompany")]
[assembly: ExportEffect(typeof(FocusEffect), "FocusEffect")]
namespace EffectsSample.UWP
{
    class FocusEffect : PlatformEffect
    {
        protected override void OnAttached()
        {
            try
            {
                (Control as Windows.UI.Xaml.Controls.Control).PointerEntered += pointer_Entered;    
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
            }
        }
        private void pointer_Entered(object sender, RoutedEventArgs e)
        {           
            (this.Control as Windows.UI.Xaml.Controls.Control).Background = new SolidColorBrush(Colors.Red);   
        }         
        protected override void OnDetached()
        {
        }
       }
    }

Effect is added to button in xaml like below:

   <Button Text="Button">
        <Button.Effects>
            <local:FocusEffect />
        </Button.Effects>
    </Button>

The issue is that background is not changing on Pointer Enter Event. Instead it changes on Pointer Exit.
Any help will be appreciated!


Change google map info window text when it is appearing

$
0
0

my current situation that i want when user click on marker i send a request to get clicked position address and show it in the info window it working for IOS but android has problems

Replacing the bubbling effect when rendering views by fading effect?

$
0
0

Usually when views are rendered, they show up instantly by going from opacity = 0% to 100% in 0 milliseconds, I want to override this behavior so the transition occurs smoothly, like when images are rendered, or when navigating between ContentViews inside a ContentPage, so my first attempt is to create a behavior like this:

    public class FadingBehavior : Behavior<View>
    {
        protected override async void OnAttachedTo(View view)
        {
            //assuming that the view starts rendering from 0 opacity
            await view.FadeTo(1);
            base.OnAttachedTo(view);
        }
        protected override async void OnDetachingFrom(View view)
        {
            await view.FadeTo(0);
            base.OnDetachingFrom(view);
        }
    }

but it doesn't work!

hey guys, how can i implement a scratch screen or scratch ticket using skiasharp in xamarin forms

$
0
0

i have to overlay two canvas , so when i rub or drag my finger on the canvas then the second canvas or may be any image should appear in the area that i have rubbed ...Basically i want to achieve a scratch ticket effect, how can i achieve this
Thanks in advance

How to export/save the keystore files from MAC

$
0
0

I am using MAC visual studio for xamarin forms app development. I am trying to take a back up for my android keystore files.

I found the keystore files at /Users/[username]/Library/Developer/Xamarin/Keystore/ in my MAC using keystore explorer. How can I export or save the keystore files from here? Copy/paste, drag and drop and export options are not working.

Anyone, please tell me a way to export the keystore files from MAC?

Run On Android Device Fails

$
0
0

The first thing this app does is create a SQLite entry and the app immediately fails when running on a real device with the "unfortunately stopped" message. From the ADB error list, it looks like it is failing on SQLite / so access. It didn't prompt for Storage permissions, but I added that and it still fails. This runs fine in the emulator. Any ideas or suggestions?

How can i Implement a chat application by using signalR in xamarin forms

$
0
0

How can i Implement a chat application by using signalR in xamarin forms

How to worked Configure ADAL with Intune App SDK and SSO?

$
0
0

I have follow this Link but set pin page is open after ADAL Authentication but enter four digit pin Enroll page was not open.

FLow of app on launch is:

Login(Auth ADAL)
Set PIN

1 and 2 both step are done

we need open Enter PIN Page Every time "If app is closed and again launch from icon on device (Every time close and open)"

1.Enter PIN


filter list using name

$
0
0

I have to filter list using name.
In my listview I have name and ID.
I have to filter the list using name enter by user.
I'm not going to use the searchbar.

How can i Implement a chat application by using signalR in xamarin forms

$
0
0

How can i Implement a chat application by using signalR in xamarin forms

Thanks in advance!!

Camera and gallery are not working in android, showing permission exception

$
0
0

Getting the following exception when loading the camera and gallery in my project.

Camera

Exception:>Plugin.Media.Abstractions.MediaPermissionException: Camera permission(s) are required. at Plugin.Media.MediaImplementation+d__17.MoveNext () [0x0009

Gallery

Does not have storage permission granted, requesting.01-02 15:16:08.566 I/mono-stdout(12958): Does not have storage permission granted, requesting. Storage permission Denied. 01-02 15:16:08.567 I/mono-stdout(12958): Storage permission Denied.[0:] Exception:>Plugin.Media.Abstractions.MediaPermissionException: Storage permission(s) are required. at Plugin.Media.MediaImplementation+d__16.MoveNext () [0x00091] in <5939e997f291496f805023da28f3a447>:0 --- End of stack trace from previous location where exception was thrown ---

I have added all the permissions in my manifest file.

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Added following codes in mainactivity:

[assembly: UsesFeature("android.hardware.camera", Required = false)]
[assembly: UsesFeature("android.hardware.camera.autofocus", Required = false)]

public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
 {
     PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
 }

Provider details in manifest file:

<provider android:name="android.support.v4.content.FileProvider" android:authorities="{packagename}.fileprovider" android:exported="false" android:grantUriPermissions="true">
    <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
</provider>

file_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-files-path name="my_images" path="Pictures" />
    <external-files-path name="my_movies" path="Movies" />
</paths>

Camera and Gallery codes:

public async void OpenMygallery()
    {
        try
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsPickPhotoSupported)
            {
                ShowAlert("No photos available.");
                return;
            }

            _mediaFile = await CrossMedia.Current.PickPhotoAsync();

            if (_mediaFile == null)
                return;

            tweetPicture.Source = ImageSource.FromStream(() =>
            {
                return _mediaFile.GetStream();
            });
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine("Exception:>" + ex);
        }
    }

public async void OpenMyCamera()
    {
        try
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                ShowAlert("No camera available.");
                return;
            }

            _mediaFile = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                Directory = "Sample",
                Name = "test.jpg",
                AllowCropping = true
            });

            if (_mediaFile == null)
                return;

            tweetPicture.Source = ImageSource.FromStream(() =>
            {
                return _mediaFile.GetStreamWithImageRotatedForExternalStorage();
            });
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine("Exception:>" + ex);
        }
    }

Bug Information:

Version Number of Plugin: 4.0.1.5

Device Tested On: Redmi Note 5 Pro

Version of VS: 15.9.3

Version of Xamarin: 3.4.0.1008975

Anybody please suggest a solution for this?

My app command bar changed its color for no good reason

$
0
0

A strange thing happened to my application. The main window command bar (the one with minimize and maximize buttons) from common gray became black. The buttons stayed gray. I don't think I did anything to cause this.
Could you please give me any idea what did this and how to change this back?

How to Set Border Color for `Entry` tag in XAML.

$
0
0

Can we set or Change Border Color of Entry tag in XAML ?

Latitude and Longitude from Xamarin using IOS (Simulator or real device)

$
0
0

Hello There Guys,

Has anyone ever gotten longitude and latitude from an address in the iOS app successfully?

When i tried i kept getting this error

{Foundation.NSErrorException: Error Domain=kCLErrorDomain Code=8 "(null)"
at Xamarin.Essentials.Geocoding+d__4.MoveNext () [0x00075]

Funny it works in the android project.

I have used Xamarin Essentials and Xam.plugin.Geolocator, same error.

When i searched online it was said Apple does not recognise the address as a . valid one. If true, then whats the advisable solution since it works perfectly on android?

WOuld deeply appreciate your help

3D Touch in forms (including peek/pop!)


How could I put sound of success in the QR code?

$
0
0

I would like that when scanning a code qr if it is correct you hear a correct sound or if you did not find a scanner one alert

ListView ItemSelected and ItemTapped not working with ContextActions

$
0
0

Hi all.
I have a problem with ListView. I have a viewcell with custom control that has TapGestureRecognizer and it works well. But when I added Context Action to ViewCell ItemSelected stoped working.
What can I do to solve this problem?
Thanks for helping.

When does a file used to display an image in a ListView get released?

$
0
0

In our app, we draw a sketch using SkiaSharp. OnSave, the sketch is saved to a file and the commands used by SkiaSharp to draw the image are saved to SQLite. That way, at a later time, in a LoadView, we can have a list of sketches to chose from in a ListView.

The sketches are displayed via a path to the images like this:
<Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" Source="{Binding PhotoPath}" />

When an image is tapped that info is passed back to the SketchView where the details for creating the image are read from the table and displayed. If I make a small change (i.e. take very little time) and then save the Image over the previous version, sometimes I get the following exception:
Exception in SketchView.OnSaveButtonClicked: System.IO.IOException: The process cannot access the file <the file that I am trying to overwrite> because it is being used by another process.

It seems that if I spend more time adding to the sketch, or wait longer before tapping Save, that it is less likely to throw this exception.

I tried to only show the file name in the LoadView (i.e. no image). It is not a user friendly UI then, but it did not result in the Exception after around a dozen tries.

All that leads me to think that the LoadView hangs onto the images long after the View is closed. What can I do to free up that memory? What else should I consider?
Thanks!

Behaviors in ControlTemplates

$
0
0

I have a ControlTemplate defined in App.xaml for pages with ListViews like so:

<ControlTemplate x:Key="BaseModelListPageTemplate">
    <StackLayout>
        <Label
        Text="{TemplateBinding BindingContext.Category}"
        BackgroundColor="Green"
        TextColor="White"
        FontSize="24"
        FontAttributes="Bold"/>
        <ListView
            x:Name="ItemListView"
            HasUnevenRows="true"
            ItemsSource="{TemplateBinding BindingContext.ItemsList}"
            IsPullToRefreshEnabled="true"
            IsRefreshing="{TemplateBinding BindingContext.IsBusy, Mode=OneWay}"
            RefreshCommand="{TemplateBinding BindingContext.ReloadCommand}"
            ItemTemplate="{StaticResource BaseModelDataTemplateSelector}">
            <ListView.Behaviors>
                <Behaviors:ListViewScrollBehavior Command="{TemplateBinding BindingContext.LoadMoreCommand}"/>
            </ListView.Behaviors>
        </ListView>
    </StackLayout>
</ControlTemplate>

All bindings compile with no errors. The trouble is that an InvalidOperationException gets thrown: Operation is not valid due to the current state of the object. It worked fine when it was directly in a page and not in a ControlTemplate.

StackTrace is of little help:

at Xamarin.Forms.TemplateBinding+<Apply>d__17.MoveNext () [0x00018] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplateBinding.cs:82 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018 
  at UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24 
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSAction.cs:163 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at EZDelivery.iOS.Application.Main (System.String[] args) [0x00008] in /Users/taylorartunian/Projects/EZDelivery/iOS/Main.cs:17 

Loading pins into map asynchronously

$
0
0

Is there a way to load pins without blocking the UI Thread? Would that be realistic for a great number of points?

I'm currently using amay's Google Maps library, and doing so isn't quite possible. While you can run the code on a different thread/with await and then call the method to actually add the pin in the main thread, doing so is a huge hit to performance.

Are there any libraries that support this? Is this doable if using custom renderers?

Ideally, end product would be a map that binds its pin source to an ObservableCollection to update it automatically in an asynchronous way (with the asynchronous part being the hard one), but that's another story.

Viewing all 91519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>