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

ListView inside CarouselView : Scroll hardly

$
0
0

Hey,

I created a Listview inside a CarouselView, but when i want to scroll in my listview, my carousel can take the focus and it can horizontal scroll too.

How can I lock my carouselView ?

Thanks


SearhBox (Multiselect page)

$
0
0

I have an ObservableCollection with list of users data which is wrapped for multiselect page.
I added SearhBox to the multiselect page but I can not make it work.
Here is an example of code:

public class WrappedItemSelectionTemplate : ViewCell
            {
                public WrappedItemSelectionTemplate() : base()
                {


                    Label Title = new Label() { TextColor = Color.Black };

                    Title.SetBinding(Label.TextProperty, new Binding("Item.Title"));
                    Label Email = new Label() { FontSize = 14 };

                    Email.SetBinding(Label.TextProperty, new Binding("Item.Email"));

                    Switch mainSwitch = new Switch() { HorizontalOptions = LayoutOptions.End };
                    mainSwitch.SetBinding(Switch.IsToggledProperty, new Binding("IsSelected"));


                    StackLayout Stack = new StackLayout();

                    Stack.Children.Add(Title);
                    Stack.Children.Add(Email);
                    Grid grid = new Grid();
                    grid.Children.Add(Stack, 0,0);
                    grid.Children.Add(Email, 0, 1);
                    grid.Children.Add(mainSwitch, 1, 0);
                    View = grid;
                }
            }
            public List<WrappedSelection<T>> WrappedItems = new List<WrappedSelection<T>>();

            public SelectMultipleBasePage(List<T> items)
            {
                WrappedItems = items.Select(item => new WrappedSelection<T>() { Item = item, IsSelected = false }).ToList();
                ListView mainList = new ListView()
                {
                    ItemsSource = WrappedItems,
                    ItemTemplate = new DataTemplate(typeof(WrappedItemSelectionTemplate)),
                };

                mainList.ItemSelected += (sender, e) =>
                {
                    if (e.SelectedItem == null) return;
                    var o = (WrappedSelection<T>)e.SelectedItem;
                    o.IsSelected = !o.IsSelected;
                    ((ListView)sender).SelectedItem = null; //de-select
                };

                // SearchBar added
                StackLayout Stack = new StackLayout();
                SearchBar Search = new SearchBar(); 
                Stack.Children.Add(Search);
                Stack.Children.Add(mainList);
                Search.TextChanged += (sender, e) =>
                {
                    SearchBar_TextChanged();
                };
                Content = Stack;

                void SearchBar_TextChanged()
                {


                }
            }

When I ussed SearchBox in my cases before I was filtering an ObservableCollection like:

new ObservableCollection<Models.M_UsersAndGroups>(
from user in userList           
where (!String.IsNullOrEmpty(user.Title) && user.Title.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0) 
select user)

But I can't do the same because it's wrapped. How I can use SearhBox for field Title in that case?

How to collapse a row in a grid?

$
0
0

I've a view with a grid with 3 rows. In the first row ( 0 ) there is an image like as header. I wish to collapse the row0 when I tap on image to I've more space in the view.
How doing?

How to drawing a Rectangle using SkiaSharp?

$
0
0

Hi everybody!
How to drawing a Rectangle using SkiaSharp?
If you have better way, please tell me!
Thank you!

Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources

$
0
0

Hey Guys,
I am facing a problem with my android project of my Xamairn.Forms Application.

When I run the Solution I get the following Exception:
07-19 15:02:10.323 E/mono ( 3650): 07-19 15:02:10.323 E/mono ( 3650): Unhandled Exception: 07-19 15:02:10.323 E/mono ( 3650): Java.Lang.NullPointerException: Attempt to invoke virtual method "android.content.res.Resources android.content.Context.getResources()" on a null object reference 07-19 15:02:10.323 E/mono ( 3650): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 07-19 15:02:10.323 E/mono ( 3650): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00084] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029 07-19 15:02:10.323 E/mono ( 3650): at Android.Runtime.JNIEnv.FinishCreateInstance (IntPtr instance, IntPtr jclass, IntPtr constructorId, Android.Runtime.JValue* constructorParameters) [0x0000b] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:306 07-19 15:02:10.323 E/mono ( 3650): at Android.Views.ScaleGestureDetector..ctor (Android.Content.Context context, IOnScaleGestureListener listener) [0x000d8] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.ScaleGestureDetector.cs:477 07-19 15:02:10.323 E/mono ( 3650): at DevExpress.Mobile.DataGrid.Android.DroidGestureRecognizerService..ctor () [0x0005c] in <filename unknown>:0 07-19 15:02:10.323 E/mono ( 3650): at DevExpress.Mobile.Forms.Init () [0x0003c] in <filename unknown>:0 07-19 15:02:10.323 E/mono ( 3650): at App4Business.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x000a8] in c:\Users\pasqueju\Desktop\App4Business\App\App4Business\App4Business.Droid\MainActivity.cs:48 07-19 15:02:10.323 E/mono ( 3650): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:2857 07-19 15:02:10.323 E/mono ( 3650): at (wrapper dynamic-method) System.Object:6d3f2cc8-3619-482a-a12e-1975032c5182 (intptr,intptr,intptr) 07-19 15:02:10.323 E/mono ( 3650): --- End of managed exception stack trace --- 07-19 15:02:10.323 E/mono ( 3650): java.lang.NullPointerException: Attempt to invoke virtual method "android.content.res.Resources android.content.Context.getResources()" on a null object reference 07-19 15:02:10.323 E/mono ( 3650): at android.view.ViewConfiguration.get(ViewConfiguration.java:364) 07-19 15:02:10.323 E/mono ( 3650): at android.view.ScaleGestureDetector.<init>(ScaleGestureDetector.java:207) 07-19 15:02:10.323 E/mono ( 3650): at android.view.ScaleGestureDetector.<init>(ScaleGestureDetector.java:189) 07-19 15:02:10.323 E/mono ( 3650): at md5c5e8c35f6309ca9ae42ed30d74b361ec.MainActivity.n_onCreate(Native Method) 07-19 15:02:10.323 E/mono ( 3650): at md5c5e8c35f6309ca9ae42ed30d74b361ec.MainActivity.onCreate(MainActivity.java:28) 07-19 15:02:10.323 E/mono ( 3650): at android.app.Activity.performCreate(Activity.java:6237) 07-19 15:02:10.323 E/mono ( 3650): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 07-19 15:02:10.323 E/mono ( 3650): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
My MainAcitivity:

[Activity(Label = "App4Business", Theme = "@style/AppTheme", Icon = "@drawable/icon", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : XFormsApplicationDroid { protected override void OnCreate(Bundle bundle) { var container = new SimpleContainer(); container.Register<IDevice>(t => AndroidDevice.CurrentDevice); container.Register<IDisplay>(t => t.Resolve<IDevice>().Display); container.Register<INetwork>(t => t.Resolve<IDevice>().Network); Resolver.SetResolver(container.GetResolver()); base.OnCreate(bundle); Xamarin.Forms.Forms.SetTitleBarVisibility(AndroidTitleBarVisibility.Default); global::Xamarin.Forms.Forms.Init(this, bundle); Telerik.XamarinForms.Common.Android.TelerikForms.Init(); CachedImageRenderer.Init(); DevExpress.Mobile.Forms.Init(); CrossPushNotification.Initialize<CrossPushNotificationListener>("XXXXXXXXX"); CrossPushNotification.Current.Register(); //This service will keep your app receiving push even when closed. DependencyService.Register<ToastNotificatorImplementation>(); ToastNotificatorImplementation.Init(this); LoadApplication(new App()); } }

The exception is thrown at the DevExpress.Mobile.Forms.Init();
When I remove this line my App is starting. But I get confusing nullpointer's in other Plugins (suchlike Connectivity)

I would appreciate any help
Julian

Is possible use SearchBar in the navigation bar using Prism.Unity.Forms?

$
0
0

I'm trying use SearchBar in the navigation bar in the content page, I'm using a master detail, but a wanna use in other page no in the master detail, my master detail navigate to other page outsite from master detail, in my other page I wanna use the SearchBar no in master detail.

How to create custom render for sfchedule calendar in xamarin forms

$
0
0


i want to convert small green dot in to big green dot like this blow


here we use sfschedule package for creating calendar , can any one tell me how to get this please tell me any one

Multiple colors in Bindable Label

$
0
0

I have a label which has its binding through a view model. Out of label's text few characters need to be in a different color. I thought of using formatted text and using different spans, but unfortunately we can't bind spans with view model. Can someone help me what to do? (my text is like " Lorem epsum ...more". The requirement is to have a different color for "...more".


How to implement an Android Service in Xamarin.Forms

$
0
0

Hi! I have an application and I want to periodically check from a web service if an item has been added to a table on a database, the new item should be added to the listview the user sees.
I'm using PCL and I did accomplish it creating a new Task and then with a timer checking every specific time but I want it to work if the app is closed too, the user should get a notification that a new item has been added.
So I was doing some research and I came across android services, the info said that the service will continue, regardless of the app state, until you tell it to stop. But I haven't found many examples and I don't know how to implement the code that I already had to the service.

This is the code that I had
Task.Run(() =>
{
Device.StartTimer(TimeSpan.FromSeconds(secs), checkUpdates);
});

bool checkUpdates()
          {
            if (isOnline)
            {
                var lastUp= Application.Current.Properties["lastUpdate"] as string;

    //the method returns a true if an item has been added
                if (service.NewItem(DateTime.Parse(lastUp)))
                {
                    var it = service.getNewItem(DateTime.Parse(lastUp));

                    Device.BeginInvokeOnMainThread(() =>
                    {    
                            notification.ShowNotification(it.Title, 1000);
                            listView.Insert(0, it);
                     }                            
                    });                  
                }
                App.Current.Properties["lastUpdate"] = DateTime.Now.ToString();
            }
            return true;
        }

This is the code that works when the app is open, and I'm trying to use dependecy services to consume the service in my PCL. Here's what I've got so far:

     public interface IService
        {
            void Start();
        }

      [Service]
        public class DependentService : Service, IService
        {
            public void Start()
            {
                var intent = new Intent(Android.App.Application.Context, typeof(DependentService));
                Android.App.Application.Context.StartService(intent);
            }

            public override IBinder OnBind(Intent intent)
            {
                return null;
            }

            public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
            {
                // From shared code or in your PCL


                return StartCommandResult.NotSticky;
            }
        }

The problem is that I don't know how to implement the same code that I had in the timer here. Can someone please help?

Filling a sectioned RecyclerView using a SortedDictionary, ViewHolders under section not showing

$
0
0

Hi guys! I've been trying to fill a RecyclerView using a SortedDictionary<DateTime, List<Event>>. Events in this SortedDictionary need to be sectioned by DateTime. My current solution displays the headers just fine, but the events under the DateTime key are not shown. My initial approach has been to fire OnCreateViewHolder() and OnBindViewHolder() manually using the CreateViewHolder() and BindViewHolder() functions and handle the creation of both ViewHolder types inside the event listeners. I don't seem to be forgetting anything when I compare the process for the placement of the section headers with that of the event ViewHolders, but I must be missing something that causes the views for the events not to show. I hope you guys can help me with this.

Here's the code for the Adapter that I made:

public class EventsRecyclerViewAdapter : RecyclerView.Adapter {
    public SortedDictionary<DateTime, List<Event>> EventDictionary { get; set; }
    private const int TYPE_HEADER = 0;
    private const int TYPE_EVENT = 1;
    ViewGroup viewGroupHelper;

    public override int ItemCount => this.EventDictionary.Count;

    public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        LayoutInflater layoutInflater = LayoutInflater.From(parent.Context);
        View itemView;
        viewGroupHelper = parent;
        if (viewType == TYPE_HEADER) {
            itemView = layoutInflater.Inflate(Resource.Layout.view_eventlist_header, parent, false);
            return new HeaderViewHolder(itemView);
        }
        itemView = layoutInflater.Inflate(Resource.Layout.view_eventlist_event, parent, false);
        return new EventViewHolder(itemView);
    }

    public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder is EventViewHolder) {
            EventViewHolder eViewHolder = holder as EventViewHolder;
            eViewHolder.EventTitle.Text = "Test";
            return;
        }
        HeaderViewHolder hViewHolder = holder as HeaderViewHolder;
        DateTime eventStartGroup = EventDictionary.Keys.ElementAt(position);
        hViewHolder.EventStartGroup.Text = (DateTime.Today == eventStartGroup) ? "Today" : eventStartGroup.ToString("dd MMMM yyyy");
        List<Event> eventsUnderDate = EventDictionary.Values.ElementAt(position);
        FillEventsUnderDate(viewGroupHelper, position, eventsUnderDate);
    }

    private void FillEventsUnderDate(ViewGroup parent, int position, List<Event> events) {
        foreach (Event @event in events) {
            EventViewHolder holder = CreateViewHolder(parent, TYPE_EVENT) as EventViewHolder;
            BindViewHolder(holder, position++);
        }
    }

    private class HeaderViewHolder : RecyclerView.ViewHolder {
        public TextView EventStartGroup { get; set; }
        public HeaderViewHolder(View itemView) : base(itemView) {
            EventStartGroup = itemView.FindViewById<TextView>(Resource.Id.eventlist_header);
        }
    }

    private class EventViewHolder : RecyclerView.ViewHolder {
        public TextView EventTitle { get; set; }
        public EventViewHolder(View itemView) : base(itemView) {
            EventTitle = itemView.FindViewById<TextView>(Resource.Id.eventlist_event);
        }
    }
}

Thanks in advance!

How to implement an Android Service in Xamarin.Forms

$
0
0

Hi! I have an application and I want to periodically check from a web service if an item has been added to a table on a database, the new item should be added to the listview the user sees.
I'm using PCL and I did accomplish it creating a new Task and then with a timer checking every specific time but I want it to work if the app is closed too, the user should get a notification that a new item has been added.
So I was doing some research and I came across android services, the info said that the service will continue, regardless of the app state, until you tell it to stop. But I haven't found many examples and I don't know how to implement the code that I already had to the service.

This is the code that I had
Task.Run(() =>
{
Device.StartTimer(TimeSpan.FromSeconds(secs), checkUpdates);
});

bool checkUpdates()
          {
            if (isOnline)
            {
                var lastUp= Application.Current.Properties["lastUpdate"] as string;

    //the method returns a true if an item has been added
                if (service.NewItem(DateTime.Parse(lastUp)))
                {
                    var it = service.getNewItem(DateTime.Parse(lastUp));

                    Device.BeginInvokeOnMainThread(() =>
                    {    
                            notification.ShowNotification(it.Title, 1000);
                            listView.Insert(0, it);
                     }                            
                    });                  
                }
                App.Current.Properties["lastUpdate"] = DateTime.Now.ToString();
            }
            return true;
        }

This is the code that works when the app is open, and I'm trying to use dependecy services to consume the service in my PCL. Here's what I've got so far:

     public interface IService
        {
            void Start();
        }

      [Service]
        public class DependentService : Service, IService
        {
            public void Start()
            {
                var intent = new Intent(Android.App.Application.Context, typeof(DependentService));
                Android.App.Application.Context.StartService(intent);
            }

            public override IBinder OnBind(Intent intent)
            {
                return null;
            }

            public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
            {
                // From shared code or in your PCL


                return StartCommandResult.NotSticky;
            }
        }

The problem is that I don't know how to implement the same code that I had in the timer here. Can someone please help?

Filling a sectioned RecyclerView using a SortedDictionary, ViewHolders under section not showing

$
0
0

Hi guys! I've been trying to fill a RecyclerView using a SortedDictionary<DateTime, List<Event>>. Events in this SortedDictionary need to be sectioned by DateTime. My current solution displays the headers just fine, but the events under the DateTime key are not shown. My initial approach has been to fire OnCreateViewHolder() and OnBindViewHolder() manually using the CreateViewHolder() and BindViewHolder() functions and handle the creation of both ViewHolder types inside the event listeners. I don't seem to be forgetting anything when I compare the process for the placement of the section headers with that of the event ViewHolders, but I must be missing something that causes the views for the events not to show. I hope you guys can help me with this.

Here's the code for the Adapter that I made:

public class EventsRecyclerViewAdapter : RecyclerView.Adapter {
    public SortedDictionary<DateTime, List<Event>> EventDictionary { get; set; }
    private const int TYPE_HEADER = 0;
    private const int TYPE_EVENT = 1;
    ViewGroup viewGroupHelper;

    public override int ItemCount => this.EventDictionary.Count;

    public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        LayoutInflater layoutInflater = LayoutInflater.From(parent.Context);
        View itemView;
        viewGroupHelper = parent;
        if (viewType == TYPE_HEADER) {
            itemView = layoutInflater.Inflate(Resource.Layout.view_eventlist_header, parent, false);
            return new HeaderViewHolder(itemView);
        }
        itemView = layoutInflater.Inflate(Resource.Layout.view_eventlist_event, parent, false);
        return new EventViewHolder(itemView);
    }

    public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder is EventViewHolder) {
            EventViewHolder eViewHolder = holder as EventViewHolder;
            eViewHolder.EventTitle.Text = "Test";
            return;
        }
        HeaderViewHolder hViewHolder = holder as HeaderViewHolder;
        DateTime eventStartGroup = EventDictionary.Keys.ElementAt(position);
        hViewHolder.EventStartGroup.Text = (DateTime.Today == eventStartGroup) ? "Today" : eventStartGroup.ToString("dd MMMM yyyy");
        List<Event> eventsUnderDate = EventDictionary.Values.ElementAt(position);
        FillEventsUnderDate(viewGroupHelper, position, eventsUnderDate);
    }

    private void FillEventsUnderDate(ViewGroup parent, int position, List<Event> events) {
        foreach (Event @event in events) {
            EventViewHolder holder = CreateViewHolder(parent, TYPE_EVENT) as EventViewHolder;
            BindViewHolder(holder, position++);
        }
    }

    private class HeaderViewHolder : RecyclerView.ViewHolder {
        public TextView EventStartGroup { get; set; }
        public HeaderViewHolder(View itemView) : base(itemView) {
            EventStartGroup = itemView.FindViewById<TextView>(Resource.Id.eventlist_header);
        }
    }

    private class EventViewHolder : RecyclerView.ViewHolder {
        public TextView EventTitle { get; set; }
        public EventViewHolder(View itemView) : base(itemView) {
            EventTitle = itemView.FindViewById<TextView>(Resource.Id.eventlist_event);
        }
    }
}

Thanks in advance!

iOS application rejected by apple

$
0
0

Hi All,

I have just submited my iOS application on App Store but they have rejected because of my application has not support IPV6 enable network.

My app has developed in Xamarin.form.

can any one can help me how to I resolve that?

Bug: Xamarin.Froms ControlTemplate with ToolbarItem does not work

$
0
0

Description
Hello.

Basic Setup: I want to have a Xamarin.Forms.ToolbarItem and a Xamarin.Forms.ControlTemplate in a ContentPage with a ViewModel. The ToolbarItem has a Command which should be executed on Tap.

Problem: The ToolbarItem.Command has a Binding to the ViewModel.Command which does not work.
When I start and click on the ToolbarItem it does not work.

Can someone tell me if I am missing something here, or if this is a real issue?
I am not very experienced with Bug reports so if I need to add/change something pleas tell me.

Steps to Reproduce
Create .net standard Project with Prism.Template
Choose Android Project for execution
Create a new Page with new Item Prism Content Page
Navigate at startup to that page
App.xaml.cs
await NavigationService.NavigateAsync("NavigationPage/DummyPage");
Insert the Code
DummTestPage

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http:  //xamarin.com/schemas/2014/forms"
             xmlns:x="http:  //schemas.microsoft.com/winfx/2009/xaml"
             xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
             prism:ViewModelLocator.AutowireViewModel="True"
             x:Class="TestNetCore.Views.DummyPage">
    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>
    <ContentPage.ToolbarItems>
        <ToolbarItem Text="A" Clicked="MenuItem_OnClicked" Command="{Binding ToolbarTappedCommand}"></ToolbarItem>
    </ContentPage.ToolbarItems>
    <StackLayout>
        <Label FontSize="28">I AM AN EMPTY PAGE</Label>
    </StackLayout>
</ContentPage>

DummTestPage.cs

        public partial class DummyPage : ContentPage
    {
        #region Public Constructors

        public DummyPage()
        {
            InitializeComponent();
        }

        #endregion Public Constructors

        #region Private Methods

        private void MenuItem_OnClicked(object sender, EventArgs e)
        {
        }

        #endregion Private Methods
    }

DummyPageViewModel

public class DummyPageViewModel : BindableBase
    {
        #region Public Constructors

        public DummyPageViewModel()
        {
            ToolbarTappedCommand = new NewCommand();
        }

        #endregion Public Constructors

        #region Public Properties

        public ICommand ToolbarTappedCommand { get; set; }

        #endregion Public Properties
    }

    public class NewCommand : ICommand
    {
        #region Public Events

        public event EventHandler CanExecuteChanged;

        #endregion Public Events

        #region Public Methods

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public void Execute(object parameter)
        {
        }

        #endregion Public Methods
    }

Set a Breakpoint to
NewCommand.CanExecute
NewCommand.Execute
MenuItem_OnClicked
Execute Programm

Expected Behavior
Execute NewCommand.CanExecute on startup
Execute NewCommand.Execute on Tap
Execute MenuItem_OnClicked on Tap

Actual Behavior
Execute MenuItem_OnClicked on Tap

Basic Information
Version with issue: Prism Template Pack 2.0.8 | Prism.Unit.Forms 7.0.0.362
Last known good version:
Xamarin.Forms version: 2.4.0.280555
IDE: VS17 15.6.1
Screenshots
Reproduction Link
What exactly do i need to do here?

Solutions
Removeing the lines in the XAML

xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
prism:ViewModelLocator.AutowireViewModel="True"

Every thing works as expected now
2. Removeing the ControlTemplate in the XMAL

    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>

Works but you dont have a controlTemplate now :(
3. Switching ControlTemplate and ToolbarItems

    <ContentPage.ToolbarItems>
        <ToolbarItem Text="A" Clicked="MenuItem_OnClicked" Command="{Binding ToolbarTappedCommand}"></ToolbarItem>
    </ContentPage.ToolbarItems>
    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>

CanExecute is not called at beginning
And if you set the ControlTemplate as StaticRessouce (which is what I like to do) this does not work
ControlTemplate="{StaticResource BaseControlTemplate}"

Tags
Xamarin.Froms ControlTemplate ToolbarItem Binding not working

Bug: Xamarin.Froms ControlTemplate with ToolbarItem does not work

$
0
0

Description
Hello.

Basic Setup: I want to have a Xamarin.Forms.ToolbarItem and a Xamarin.Forms.ControlTemplate in a ContentPage with a ViewModel. The ToolbarItem has a Command which should be executed on Tap.

Problem: The ToolbarItem.Command has a Binding to the ViewModel.Command which does not work.
When I start and click on the ToolbarItem it does not work.

Can someone tell me if I am missing something here, or if this is a real issue?
I am not very experienced with Bug reports so if I need to add/change something pleas tell me.

Steps to Reproduce
Create .net standard Project with Prism.Template
Choose Android Project for execution
Create a new Page with new Item Prism Content Page
Navigate at startup to that page
App.xaml.cs

await NavigationService.NavigateAsync("NavigationPage/DummyPage");

Insert the Code
DummTestPage

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http:  //xamarin.com/schemas/2014/forms"
             xmlns:x="http:  //schemas.microsoft.com/winfx/2009/xaml"
             xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
             prism:ViewModelLocator.AutowireViewModel="True"
             x:Class="TestNetCore.Views.DummyPage">
    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>
    <ContentPage.ToolbarItems>
        <ToolbarItem Text="A" Clicked="MenuItem_OnClicked" Command="{Binding ToolbarTappedCommand}"></ToolbarItem>
    </ContentPage.ToolbarItems>
    <StackLayout>
        <Label FontSize="28">I AM AN EMPTY PAGE</Label>
    </StackLayout>
</ContentPage>

DummTestPage.cs

        public partial class DummyPage : ContentPage
    {
        #region Public Constructors

        public DummyPage()
        {
            InitializeComponent();
        }

        #endregion Public Constructors

        #region Private Methods

        private void MenuItem_OnClicked(object sender, EventArgs e)
        {
        }

        #endregion Private Methods
    }

DummyPageViewModel

public class DummyPageViewModel : BindableBase
    {
        #region Public Constructors

        public DummyPageViewModel()
        {
            ToolbarTappedCommand = new NewCommand();
        }

        #endregion Public Constructors

        #region Public Properties

        public ICommand ToolbarTappedCommand { get; set; }

        #endregion Public Properties
    }

    public class NewCommand : ICommand
    {
        #region Public Events

        public event EventHandler CanExecuteChanged;

        #endregion Public Events

        #region Public Methods

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public void Execute(object parameter)
        {
        }

        #endregion Public Methods
    }

Set a Breakpoint to
NewCommand.CanExecute
NewCommand.Execute
MenuItem_OnClicked
Execute Programm

Expected Behavior
Execute NewCommand.CanExecute on startup
Execute NewCommand.Execute on Tap
Execute MenuItem_OnClicked on Tap

Actual Behavior
Execute MenuItem_OnClicked on Tap

Basic Information
Version with issue: Prism Template Pack 2.0.8 | Prism.Unit.Forms 7.0.0.362
Last known good version: -
Xamarin.Forms version: 2.5.0.280555
IDE: VS17 15.6.1
Screenshots
Reproduction Link
What exactly do i need to do here?

Solutions
Removeing the lines in the XAML

xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
prism:ViewModelLocator.AutowireViewModel="True"

Every thing works as expected now
2. Removeing the ControlTemplate in the XMAL

    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>

Works but you dont have a controlTemplate now :(
3. Switching ControlTemplate and ToolbarItems

    <ContentPage.ToolbarItems>
        <ToolbarItem Text="A" Clicked="MenuItem_OnClicked" Command="{Binding ToolbarTappedCommand}"></ToolbarItem>
    </ContentPage.ToolbarItems>
    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>

CanExecute is not called at beginning
And if you set the ControlTemplate as StaticRessouce (which is what I like to do) this does not work
ControlTemplate="{StaticResource BaseControlTemplate}"

Tags
Xamarin.Froms ControlTemplate ToolbarItem Binding not working


Help URGENT!!!! Simple http get....receving exception

$
0
0

To be honest i have dozen app accessing backend api ....its driving me crazy...in fact my boss is not happy at all

i create a blank xamarin forms netstandard 2

var uri = "some url to get";
var client = new HttpClient();
var response = await client.GetAsync(uri);
var text = await response.Content.ReadAsStringAsync();

With this code above in a button handler

Getting exception in GetAsync() line

{System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error getting response stream (ReadDone2): ReceiveFailure ---> System.Exception: at System.Net.WebConnection.HandleError (System.Net.WebExceptionStatus st, System.Exception e, System.String where) [0x00031] in :0
at System.Net.WebConnection.ReadDone (System.IAsyncResult result) [0x00056] in :0
at System.Net.Sockets.SocketAsyncResult+<>c.b__27_0 (System.Object state) [0x00000] in :0
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00015] in :0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in :0
at ObjCRuntime.Runtime.ThreadPoolDispatcher (System.Func1[TResult] callback) [0x00006] in <b7935acd70e343049845d6fd73e5ec44>:0 at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00009] in <cf9013b38a4e4129bd64785080dd2844>:0 at System.Net.WebConnection.HandleError (System.Net.WebExceptionStatus st, System.Exception e, System.String where) [0x00031] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:439 --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00059] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:1033 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <cf9013b38a4e4129bd64785080dd2844>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x003d3] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:402
--- End of inner exception stack trace ---
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x0046c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:406
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <cf9013b38a4e4129bd64785080dd2844>:0 at System.Net.Http.HttpClient+<SendAsyncWorker>d__48.MoveNext () [0x00080] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:276 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0
at App7.MainPage+d__1.MoveNext () [0x00051] in C:\Users\gilbe\source\repos\App7\App7\App7\MainPage.xaml.cs:27 }

Thanks very much

Bug: Xamarin.Froms ControlTemplate with ToolbarItem does not work

$
0
0

Description
Hello.

Basic Setup: I want to have a Xamarin.Forms.ToolbarItem and a Xamarin.Forms.ControlTemplate in a ContentPage with a ViewModel. The ToolbarItem has a Command which should be executed on Tap.

Problem: The ToolbarItem.Command has a Binding to the ViewModel.Command which does not work.
When I start and click on the ToolbarItem it does not work.

Can someone tell me if I am missing something here, or if this is a real issue?
I am not very experienced with Bug reports so if I need to add/change something pleas tell me.

Steps to Reproduce
Create .net standard Project with Prism.Template
Choose Android Project for execution
Create a new Page with new Item Prism Content Page
Navigate at startup to that page
App.xaml.cs

await NavigationService.NavigateAsync("NavigationPage/DummyPage");

Insert the Code
DummTestPage

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http:  //xamarin.com/schemas/2014/forms"
             xmlns:x="http:  //schemas.microsoft.com/winfx/2009/xaml"
             xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
             prism:ViewModelLocator.AutowireViewModel="True"
             x:Class="TestNetCore.Views.DummyPage">
    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>
    <ContentPage.ToolbarItems>
        <ToolbarItem Text="A" Clicked="MenuItem_OnClicked" Command="{Binding ToolbarTappedCommand}"></ToolbarItem>
    </ContentPage.ToolbarItems>
    <StackLayout>
        <Label FontSize="28">I AM AN EMPTY PAGE</Label>
    </StackLayout>
</ContentPage>

DummTestPage.cs

        public partial class DummyPage : ContentPage
    {
        #region Public Constructors

        public DummyPage()
        {
            InitializeComponent();
        }

        #endregion Public Constructors

        #region Private Methods

        private void MenuItem_OnClicked(object sender, EventArgs e)
        {
        }

        #endregion Private Methods
    }

DummyPageViewModel

public class DummyPageViewModel : BindableBase
    {
        #region Public Constructors

        public DummyPageViewModel()
        {
            ToolbarTappedCommand = new NewCommand();
        }

        #endregion Public Constructors

        #region Public Properties

        public ICommand ToolbarTappedCommand { get; set; }

        #endregion Public Properties
    }

    public class NewCommand : ICommand
    {
        #region Public Events

        public event EventHandler CanExecuteChanged;

        #endregion Public Events

        #region Public Methods

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public void Execute(object parameter)
        {
        }

        #endregion Public Methods
    }

Set a Breakpoint to
NewCommand.CanExecute
NewCommand.Execute
MenuItem_OnClicked
Execute Programm

Expected Behavior
Execute NewCommand.CanExecute on startup
Execute NewCommand.Execute on Tap
Execute MenuItem_OnClicked on Tap

Actual Behavior
Execute MenuItem_OnClicked on Tap

Basic Information
Version with issue: Prism Template Pack 2.0.8 | Prism.Unit.Forms 7.0.0.362
Last known good version: -
Xamarin.Forms version: 2.5.0.280555
IDE: VS17 15.6.1
Screenshots
Reproduction Link
What exactly do i need to do here?

Solutions
Removeing the lines in the XAML

xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
prism:ViewModelLocator.AutowireViewModel="True"

Every thing works as expected now
2. Removeing the ControlTemplate in the XMAL

    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>

Works but you dont have a controlTemplate now :(
3. Switching ControlTemplate and ToolbarItems

    <ContentPage.ToolbarItems>
        <ToolbarItem Text="A" Clicked="MenuItem_OnClicked" Command="{Binding ToolbarTappedCommand}"></ToolbarItem>
    </ContentPage.ToolbarItems>
    <ContentPage.ControlTemplate>
        <ControlTemplate>
            <StackLayout>
                <Grid>
                    <BoxView BackgroundColor="Lime" />
                    <Label>I TEST ControlTemplate</Label>
                </Grid>
                <ContentPresenter />
            </StackLayout>
        </ControlTemplate>
    </ContentPage.ControlTemplate>

CanExecute is not called at beginning
And if you set the ControlTemplate as StaticRessouce (which is what I like to do) this does not work
ControlTemplate="{StaticResource BaseControlTemplate}"

Tags
Xamarin.Froms ControlTemplate ToolbarItem Binding not working

Help URGENT!!!! Simple http get....receving exception

$
0
0

To be honest i have dozen app accessing backend api ....its driving me crazy...in fact my boss is not happy at all

i create a blank xamarin forms netstandard 2

var uri = "some url to get";
var client = new HttpClient();
var response = await client.GetAsync(uri);
var text = await response.Content.ReadAsStringAsync();

With this code above in a button handler

Getting exception in GetAsync() line

{System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error getting response stream (ReadDone2): ReceiveFailure ---> System.Exception: at System.Net.WebConnection.HandleError (System.Net.WebExceptionStatus st, System.Exception e, System.String where) [0x00031] in :0
at System.Net.WebConnection.ReadDone (System.IAsyncResult result) [0x00056] in :0
at System.Net.Sockets.SocketAsyncResult+<>c.b__27_0 (System.Object state) [0x00000] in :0
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00015] in :0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in :0
at ObjCRuntime.Runtime.ThreadPoolDispatcher (System.Func1[TResult] callback) [0x00006] in <b7935acd70e343049845d6fd73e5ec44>:0 at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00009] in <cf9013b38a4e4129bd64785080dd2844>:0 at System.Net.WebConnection.HandleError (System.Net.WebExceptionStatus st, System.Exception e, System.String where) [0x00031] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System/System.Net/WebConnection.cs:439 --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00059] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System/System.Net/HttpWebRequest.cs:1033 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <cf9013b38a4e4129bd64785080dd2844>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x003d3] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:402
--- End of inner exception stack trace ---
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x0046c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:406
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <cf9013b38a4e4129bd64785080dd2844>:0 at System.Net.Http.HttpClient+<SendAsyncWorker>d__48.MoveNext () [0x00080] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:276 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0
at App7.MainPage+d__1.MoveNext () [0x00051] in C:\Users\gilbe\source\repos\App7\App7\App7\MainPage.xaml.cs:27 }

Thanks very much

Dynamic items in grid

$
0
0

How can I receive items from REST service as items dynamic in grid like add more rows dynamically to fit items in columns, load more items in the page, I just have a problem with how to do the grid, I can deal with REST but the layout it's the problem

convert java code to xamarin forms

$
0
0

Hi, i am new in xamarin forms and i want to implement image encryption and decryption. I have java code that do the encryption and decryption for the image and i want to convert it to C# that work in xamarin forms and this is my java code can any one covert it to me please.

package imageencryptanddecrypt;

import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.security.SecureRandom;
import javax.imageio.ImageIO;


public class ImageEncryptAndDecrypt {


   public static void main(String s[]){

    String sPath="picture.jpg";
    String dPath="picture.jpg";
    String password="1234";
   StringBuilder sb=new StringBuilder();
    char st; 
    int value;
    try{
        for (int i = 0; i < password.length(); i++) {
             st=password.charAt(i);
             value=(int)st;
             sb.append(value);
        }
    SecureRandom sr= SecureRandom.getInstance("SHA1PRNG");
    sr.setSeed(sb.toString().getBytes());
    BufferedImage FSImg=ImageIO.read(new File(sPath));  
        for (int w = 0; w < FSImg.getWidth(); w++) {
            for (int h = 0; h < FSImg.getHeight(); h++) {
                Color color=new Color(FSImg.getRGB(w, h));
                Color newColor=new Color(color.getRed()^sr.nextInt(255), color.getGreen()^sr.nextInt(255), color.getBlue()^sr.nextInt(255));
                FSImg.setRGB(w, h, newColor.getRGB());
            }
        }
    System.out.println("Process Completed!!..");
    ImageIO.write(FSImg, "bmp", new File(dPath));
    System.out.println("Wrote to "+dPath);
    }catch(Exception e){
    e.printStackTrace();}
    }

}
Viewing all 58056 articles
Browse latest View live


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