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

How can i add image in notification (remote) ?


How to design a entry that accepts date range

$
0
0

Hi,
I require a input control which accepts date range ,having a placeholder as dd/mm/yyyy-dd/mm/yyyy.
Attaching the screen shot how it should look like

Suggestions please!

Consuming Soap asmx webservice in Xamarin.Forms Application Sync-Async conflict between platforms

$
0
0

I have an old soap asmx webservice with sync endpoints. When you add a service reference on each platform, android and ios implements it correctly as sync but UWP seems to have only async version. I have little bit investigated and it seems that this is how uwp, wpf etc. as default only allows async.
So my question is how to work with this when I have to do a DI using an interface, i want to work only sync endpoints. It is not good idea to call
GetItemsAsync().Result, i believe. Can anyone suggest how to get this working for UWP?

cannot show urhosharp surface multiple times

$
0
0

When the user open the view, navigate backwards and open the view a second time, the app crashes.
Any idea how to go around this issue?
Idealy, I would like to call:

skyUrho = await urhoSurface.Show<SkyUrho>(urhoApp);

only once in the constructor but that is not possible as it is an async call.

This is the code behind of the view:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

using AlmicantaratXF.ViewModels;
using AlmicantaratXF.Model;

namespace AlmicantaratXF.Views
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class SkyUrhoSurface : ContentPage
    {
        private Sight currentSight;
        private SkyUrho skyUrho;
        private INavigation navigation;
        private Urho.ApplicationOptions urhoApp;
        public SkyUrhoSurface()
        {
            InitializeComponent();
            this.currentSight = null;
            urhoApp = new Urho.ApplicationOptions(assetsFolder: "Data");
        }
        public SkyUrhoSurface(Sight currentSight, INavigation navigation)
        {
            InitializeComponent();
            this.currentSight = currentSight;
            this.navigation = navigation;
            urhoApp = new Urho.ApplicationOptions(assetsFolder: "Data");
        }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            skyUrho = await urhoSurface.Show<SkyUrho>(urhoApp);
          //SkyUrho skyUrho = new SkyUrho(new Urho.ApplicationOptions(assetsFolder: "Data"));
            skyUrho.PageVisible = true;
            skyUrho.StarSelection = (currentSight != null);
            buttonShootThisBody.BindingContext = skyUrho;
            labelLat.BindingContext = skyUrho;
            labelLon.BindingContext = skyUrho;
            labelAltitude.BindingContext = skyUrho;
            labelAzimuth.BindingContext = skyUrho;
            labelBodysName.BindingContext = skyUrho;
            labelBodysDirection.BindingContext = skyUrho;
            labelGPSStatus.BindingContext = skyUrho;
            //activityIndicator.BindingContext = skyUrho;
            activityIndicator.IsVisible = false;
            activityIndicator.IsRunning = false;
        }
        protected override async void OnDisappearing()
        {
            base.OnDisappearing();
            if (skyUrho != null)
                skyUrho.PageVisible = false;
        }
        void OnCheckBoxNamesChanged(object sender, CheckedChangedEventArgs e)
            {
                if(skyUrho!=null)
                    skyUrho.Names = e.Value;
            }
        void OnButtonShootThisBodyClicked(object sender, EventArgs args)
        {
            if(skyUrho!=null)
                if(skyUrho.SelectedStar!=null)
                    this.currentSight.StarID = (int)skyUrho.SelectedStar;
            navigation.PopAsync();
        }
    }
}

MVVM Question

$
0
0

Hi Guys, I am new to MVVM in XF . Need your help as need to show the discounted price on the view page. Your helps are much appreciated.

`private int _Discount;
public int Discount
{
    set
    {
        _Discount = value;
        OnPropertyChanged();
    }
    get
    {
        return _Discount;
    }
}

private int _DiscountedPrice;
public int DiscountedPrice
{
    set
    {
        _DiscountedPrice = value;
        OnPropertyChanged();
    }
    get
    {
        return _DiscountedPrice;
    }
}

private Product _SelectedProduct;
public Product SelectedProduct
{
    set
    { 
        _SelectedProduct = value;
        OnPropertyChanged();
    }
    get
    {
        return _SelectedProduct;
    }
}

My Product Model is as follows

` public int Id { get; set; }
public string ProductName { get; set; }
public string Comments { get; set; }
public decimal Rating { get; set; }
public int CategoryID { get; set; }
public int Price { get; set; }
public string ImageUrl { get; set; }
public string BestSell { get; set; }
public int Discount { get; set; }

SkiaSharp moving bitmap and elements draw on canvas

$
0
0

Hello,

I'm using SkiaSharp and I'm drawing a bitmap that I'm able to move and zoom. I need to draw rectangles on this image (SKPath). When the bitmap is moved or zoomed, the path stays on the same position and doesn't follow the bitmap. It seems that the SKPath is draw on the canvas and not directly on the bitmap.

Is there's any way to fit an SKPath according to bitmap transformation ?

Thanks for any help

Mikke

Stream video from ip camera to Azure Media Services

$
0
0

Hi Everyone,

I am currently looking for a component that would work on both IOS and Android in Xamarin Forms that can stream to Azure media services from an ip camera that the phone will be connected to. We already use libvlc for streaming directly from the ip camera using rtsp protocol. There is no way that I could find using libvlc to stream RTMP/HTTP to Azure. If anyone can point me in the right direction for such component I would highly appreciate it.

Forms frame isn't the same on iOS

$
0
0

I was using Xamarin Forms to create Android version with frames without any custom renderer of frame, it's fine. But when I use it on iOS, all frames are shadowed and separated to each other, it's weird. Should I make a custom renderer for iOS or it should be the same without any modification?


How do I publish a message from a static class?

$
0
0

I have code that follows the pattern below. (Sorry for its length; this is a problem spread across a few files.)

I have a base class that implements a system like INotifyPropertyChanged but uses the Xamarin.Forms.MessagingCenter.

The first property IsBusy works fine. The class consuming the messages, SomeClassTryingToReceiveMessages, gets the message.

My problem comes in AnotherProperty, which is static and therefore does not have a this reference to use as the source of the type information in the message. I have tried all sorts of expressions in the setter but can't find one that is picked up by the consuming class.

Does anyone know how to do this or even if it is possible?

public abstract class ModelBase
{
    protected void NotifyModelStateChanged<S>( S subclass, string propertyName ) where S : ModelBase
    {
        Messaging.Publish( subclass, "StateChanged", propertyName );
    }

    protected bool SetProperty<S,T>( S subclass, ref T oldValue, T newValue, [CallerMemberName] string propertyName = null ) where S : ModelBase
    {
        if( !oldValue.Equals( (T)newValue ) )
        {
            oldValue = newValue;
            NotifyModelStateChanged( subclass, propertyName );
            return true;
        }
        return false;
    }
}


public abstract class SessionBase : ModelBase
{
    public bool IsBusy
    {
        get => _isBusy;
        set => SetProperty( this, ref _isBusy, value );
    }

    public static bool AnotherProperty
    {
        get => _anotherProperty;
        private set
        {
            Hub.Messaging.Publish( /* WHAT DO I WRITE HERE? */, "StateChanged", nameof(AnotherProperty) );
        }
    }

    private bool _isBusy = false;
    private static bool _anotherProperty = false;
}

public class ConcreteClass : SessionBase
{
    // This is the class that gets instantiated and is actually the publisher of the messages.
}


public void SomeClassTryingToReceiveMessages()
{
    public SomeClassTryingToReceiveMessages()
    {
        Hub.Messaging.Subscribe<SessionBase,string>( this, "StateChanged", HandleStateChangedMessage );
    }

    private void HandleStateChangedMessage( SessionBase session, string propertyName )
    {
        // Act on received message.
    }
}


Firing set event in the VM when a listview entry is updated in the view

$
0
0

So, I have been having trouble getting something to work. What I am basically doing is creating a listview based on data pulled from a webservice. The listview will be a list of populated entries and editors. Upon users making changes to them, I'll be sending an update request back to the web service. I am trying to make the updates from the MVVM, since that's where the object is pulled, and where the observable collection is bound from, but it's not working. I have tried several things that don't work, but here is the state of where I am (note I'm going to strip these down to a simplified relevant part of the view and view model, if there is something else I'm missing that you'd need to see, let me know).

View

<ListView ItemsSource="{Binding HeroicLineItemsGrouped, Mode=TwoWay}"
            GroupDisplayBinding="{Binding Key}"
            IsGroupingEnabled="True"
            HasUnevenRows="true"
            VerticalOptions="FillAndExpand"
            x:Name="projectListView">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <Grid Padding="10">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Entry Grid.Column="0"
                        Grid.Row="0"
                        Grid.ColumnSpan="2"
                        Text="{Binding Name, Mode=TwoWay}"
                        ClassId="{Binding ID}"
                        FontAttributes="Bold" />                                 
                </Grid>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

View Model

private ObservableCollection<Grouping<string, HeroicBudgetLineItem>> _heroicLineItemsGrouped;
public ObservableCollection<Grouping<string, HeroicBudgetLineItem>> HeroicLineItemsGrouped
{
    get => _heroicLineItemsGrouped;
    set
    {
        _heroicLineItemsGrouped = value;
        NotifyPropertyChanged("TaskList");
    }
}

public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
    System.Diagnostics.Debug.WriteLine("Notify Property Changed");
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

Basically, I am trying to figure out how to get the set event to fire when a user makes a change to the bound Entry.

login using OTP

$
0
0

hello, i used OTP by sending verification number to user's phone number, and he can login to my app, my question is how i can checked user logedin before in app and redirect to main page, or if its firs time i show login page to him/her. i mean where should i store the token and how i should autherize token to let him go inside app

OTP in xamarin.forms

$
0
0

Hi All,

I need to generate and send OTP to user entered mobile number and validate that code in my application.I gone through many sites but didn't get any clarity to do in xamarin forms bit confused :( . Could any one please put in right direction to achieve this will be more appropriated :)

Thanks in advance

Switch TapGestureRecognizer not working in listview

$
0
0

Below is my code snippet.

<ListView ItemsSource="{Binding UserList}">
<ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <StackLayout>
                                        <Switch OnColor="#D27474" ThumbColor="#D27474">
                                            <Switch.GestureRecognizers>
                                                <TapGestureRecognizer Command="{Binding TestCommand}"></TapGestureRecognizer>
                                            </Switch.GestureRecognizers>
                                        </Switch>
                                    </StackLayout>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
</ListView>

Use Plugin.BLE With Xamarin // Usar Plugin.BLE com Xamarin

Can you do drop shadows in Xamarin.Forms Shapes?

$
0
0

Is there a way to use Xamarin.Forms Shapes to do drop shadow?

Background:
We are currently using SkiaSharp for custom drawing and animations, SkiaSharp is able to do to drop shadows. However it is massive, libSkiaSharp.so is 6.6 MB on arm64-v8a and 5.1 MB on arm32eabi-v7a, together it they add a massive amount to the size of our apks/ipa.

We are looking at switching to Shapes because it would save us a lot of space. However we need drop shadows and can't see how to do this with Xamarin.Forms Shapes.


How To Put User's Personal Information Into Firebase Realtime Database After Authentication?

$
0
0
I 'm authenticating the users with Firebase Authentication In Xamarin.Forms Project. Authentication is Successfull but I'm stuck at a point how to Put User's personal Data Such As Image, Name, Birth Etc To Firebase Realtime Database After the Authentication. AnyOne Can Help Me Regarding This Issue? Thanks

How to Apply Role base authorization in xamarin forms

$
0
0

**In order to control which user have permission to access a page in the application like in web application we can control that by user roles
in the controller or in pege.cs file in razor pages we do it like

[Authorize(Roles = "Manager,Administrator")]
public class DocumentsController : Controller
{
//Action methods
}

, how to do this authorization in xamarin forms**

Use Status bar in the page of xamarin.forms?

$
0
0

I am using Xamarin.Forms Shell and want to use the status bar like below

just in the first page of the shell use the status bar. not full screen

and will also keep the bottom area no use.

How to refresh page content when tab reslected

How to Apply Role base authorization in xamarin forms

$
0
0

**In order to control which user have permission to access a page in the application like in web application we can control that by user roles
in the controller or in pege.cs file in razor pages we do it like

[Authorize(Roles = "Manager,Administrator")]
public class DocumentsController : Controller
{
//Action methods
}

, how to do this authorization in xamarin forms**

Viewing all 79144 articles
Browse latest View live


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