Quantcast
Viewing all 81910 articles
Browse latest View live

Best way to insert a Native Android Activity in a Xamarin.Forms application?

Let's say I want my Xamarin.Forms application use a native Android activity as first page (then xaml pages for the next screens)

This Page from Microsoft documentation explains how to add a Xamarin Forms page in a native project; Interesting code there, but if I use it to switch to my Xamarin.forms code/pages after showing my activity, then app.xaml.cs is never called.

I also tried to tweake the activity provided in the Android project of Xamarin.Forms solution, without good result.

Is there a clean way to do this?


Widget similar to Xamarin.Android popup menu, for Xamarin.Forms?

Is there any widget, similar to Xamarin.Android popup menu, for Xamarin.Forms (especially for Android + iOS)?

Like in the image below:
Image may be NSFW.
Clik here to view.

I've already achieved those three dots button for each row, but I'm looking for some UI widget/component, that could be shown on similar position - it will be shown beside those three dots button.

Any luck?

Picture Gallery

What is the best way to show pictures like a phone gallery? I am allready able to add pictures from device gallery and show them but i always want to show 9 pictures in one page without scrolling. What is the best way to do this for all screen sizes?

<ContentPage.Content>
         <StackLayout Margin="10,10,10,10" >
                <Button Text="{i18n:Translate ButtonAdd}" Command="{Binding AddPicture}" BorderRadius="15" TextColor="White"/>
            <flv:FlowListView FlowColumnCount="3" RowHeight="{Binding Height}" SeparatorVisibility="None" HasUnevenRows="True" FlowItemsSource="{Binding ListImages}" FlowItemTappedCommand="{Binding ItemTappedCommand}" FlowLastTappedItem="{Binding LastItem}"
                              Margin="0"> 
                    <flv:FlowListView.FlowColumnTemplate>
                    <DataTemplate>
                        <Image Source="{Binding ImagePath}" Aspect="AspectFill" Margin="5,0,5,5" />
                    </DataTemplate>
                    </flv:FlowListView.FlowColumnTemplate>
                </flv:FlowListView>
            </StackLayout>
    </ContentPage.Content>

listview

Hello, I am using a listview and a collectuionView in my xamarin project. and when I remove an item from the list, it removes it from the Sqlite database. The porbleme is at the level of the list. the data disappears but the empty controller remains. I signal that I used the pancakeview nugets on my listviews. Anyone have a solution ??Image may be NSFW.
Clik here to view.

Image may be NSFW.
Clik here to view.

Image may be NSFW.
Clik here to view.

Image handling cross platform

What is the best way to load an image from a URL in Xamarin Forms and display it correctly in Android and iOS?

I try several things without good results: FFImageLoading library with AspectFill, AspectFit and Fill.

I want to put an image without knowing your dimensions to fill width container and resizing your height according to the aspect. If the width of the image is smaller than the container width, I want to scale the image to fill container width. If the image width is higher than the container width, I want the same. Of course I don't know the container width because normally it is the width of the screen.

If possible, I want to do all in the shared project without using custom renderers.

Thanks!

FreshMvvM PopToRoot Not working in Xamarin Forms(Android)

Hi

I'm using FreshMvvM , When i call await CoreMethods.PopToRoot(true) Nothing Happens in Android , am i missing something here ?

Detect when user close the app or app crashes

Hi, I am struggling with a problem. So In App we have 3 methods
OnSleep
OnResume
and
OnStart
Does xamarin have any method which detect the app close.
Or what is the best way to detect this.
Thanks

Can't load solution in VS for MAC

Suddenly, now when i try to open my solution on VS for mac i get this error:

The type initializer for 'monodevelop.projects.msbuild.msbuildevaluationcontext' threw an exception

Even on a fresh cloned repository. Anybody faced this? How did you solve it?


How can I display a page in different variants depending on a global setting ?

Hopefully my app is fully MVVM compliant. I thought I could now easily exchange the XAML code of one page with another. How can I display a page in different variants depending on a global setting ? I know DataTemplateSelector for Listviews, I need exactly the same for whole pages (especially for TabbedPages). Does that exist ?

Error Run Project Android 4.3

Severity Code Description Project File Line Suppression State
Error ADB1000: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at Mono.AndroidTools.AndroidInstalledPackage..ctor(String value) in E:\A_work\412\s\External\androidtools\Mono.AndroidTools\AndroidInstalledPackage.cs:line 55
at Mono.AndroidTools.Internal.AdbOutputParsing.ParseLastResortPackageList(String output) in E:\A_work\412\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 65
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass68_0.b__0(Task1 t) in E:\A\_work\412\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 467 at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
at System.Threading.Tasks.Task.Execute() 0

Works higher on Android
I'm testing it on a Huawei handsetImage may be NSFW.
Clik here to view.

Of course later I see that there is a program
But as if the Ajax commands didn't work to get the data

Image may be NSFW.
Clik here to view.

CollectionView background color not highting when add the items to the list

Hi, i am using collectionview for selecting multile items. when select the items, background color is coming.but my problem is when add the items to the list , now not getting the background color for iOS . working fine in android .i used in two ways but no luck.

  1. in ViewMode
    var items= ListOfScanTest.Where(x => x.ScanTestsName == SendAppointmentData.Rscantest).ToList();
    SelectedListOfScanTest = items;

  2. in .cs
    collectionList.SelectedItems = SelectedListOfScanTest .Cast < object > ().ToList();

in XAML
Image may be NSFW.
Clik here to view.

please any one help me out from this issue

Bottom items of ListView in Master-Detail Page inside TabbedPage not selectable?

Hi community,

I have an app which contains modal page (pushed to the stack using PushModalAsync) that is a TabbedPage. One of the tabs of the tabbed pages is a Master-Detail page. On the Detail page I have a ListView that's displayed to the bottom of the view area of the tabbed page. The items in the ListView at the bottom of the view area can't be selected, as if there's an invisible area overlapping it.

My app is using the latest version of Xamarin.Forms. Since the app is only being used on iOS now I can't say if the same is happening in Android as well.

To demonstrate what is happening I created a demo app in which I test two cases: One is a modally pushed TabbedPage which contains a simple ContentPage with a ListView of items on it spanning the whole view area. The other case is a TabbedPage that contains a simple Master-Detail Page, with the Detail Page being the ContentPage of the former test case. In case you want to reproduce: This demo app uses the default TabbedPage and Master-Detail items in Visual Studio 2019 with only the addition of the ContentPage containing the ListView.

In case of the ContentPage being directly used inside of the TabbedPage the whole thing works as expected. I can select the item that's just right above the tabs, as you can see on the following gif:
Image may be NSFW.
Clik here to view.

In case we use a Master-Detail page, with the ContentPage from above in place of the DetailPage, as the first tab in our TabbedPage the selection problem of the bottom items occurs. I have also tested this scenario with the NavigationBar of the DetailPage set to false, but it has the same problem. You can see this in action in the gif below. Unfortunately you can't see the actual clicks, but I think this still shows what is going on:
Image may be NSFW.
Clik here to view.

Does anyone know what is happening here? I would appreciate it if someone would know a fix to this problem or could lead me to what is going wrong.

Xamarin 101 Embedded Images - can't find ..dll - any ideas how to debug?

I'm very new to Xamarin. I followed Xamarin 101 Embedded Images exactly (I think). On debug it gives me an error -
Error CS0006 Metadata file 'C:\Users\Owner\source\repos\App101EmbeddedImages\App101EmbeddedImages\App101EmbeddedImages\bin\Debug\netstandard2.0\App101EmbeddedImages.dll' could not be found

It seems like the path has a problem. App101.. is the app name. Any ideas how to figure out where the error is?
Some other peculiarities when mimicking the tutorial were that both IServiceProvider and ImageSource used in the ImageResourceExtension.cs were not highlighted in green like other names.

Check the version and download the app

Hello
How can I download the app from the Internet and display the percentage of its display and install the new version of the app

How to access dynamically created UI element ?

I am creating UI element and adding to stack layout like

StackContainer = new StackLayout();
StackContainer.Children.Add(new Entry()
{
Placeholder = "Enter text",
ClassId="2"
});
Content = StackContainer;

The important thing is the count of the element is not fixed.

Now I want to access that element how can I access the element?


connect Xamarin to rest web service

hi,
I'm starting learning Xamarin and i face problem in connecting app with DB. i built rest web services with method get and i uplode it in host. after that i add this code in app
public MainPage()
{
var mylist = GetlistAsync();
InitializeComponent();
}
private async Task<List> GetlistAsync()
{
var httpClient = new HttpClient();
var response = await httpClient.GetAsync("my url");
List Items = new List();
var content = await response.Content.ReadAsStringAsync();
Items = JsonConvert.DeserializeObject<List>(content);
return Items;
}
the problem is whenever i add run. the code will move to InitializeComponent after httpclint. getasync line without doing lines after it.
so i test if verified connectivity between your device/emulator and your server and it work . after that i tray to test the code in web application mvc and it works fine but when i tray it in xamarin form app it doesn't work .
pleas help as fast as possible
thanks

emulator android 4.3 not start

Image may be NSFW.
Clik here to view.

Is installed emulator android 4.3
but not start

Image may be NSFW.
Clik here to view.

how add image/button next to last item in collection view in xamarin forms?

i need your help i'm trying to make the following UI in xamarin forms.i want the Upload button or image at the end of list . i tried to use collection view with grid item layout .i'm able to show images like this but i can't add upload image at the end like the following . i tried to put upload image/button in the footer of collection view but it appears in bottom of the list not in next to last image . So is there any body who can help me or guide me to achieve this?
Image may be NSFW.
Clik here to view.

How to add a missing Event to CollectionView

Hi,
I really need to use an event that notifies me when the user stops scrolling (lifting finger from the display). Since Xamarin.Forms's CollectionView does not currently has that event built-in (that I can see anyways) I decided to create a custom renderer that extends the stock CollectionView. I'm quite new to all of this so I'm not sure if this is the best way.

Long story short, this functionality now works but I have unfortunately removed all the other events from my custom CollectionView. The code below is how I achieved this and I believe it's the fact that I overnight the control's delegates that it's not working. How do I do this without overriding the rest of the functionality?

using System.Diagnostics; 
using Foundation;
using test.Controls;
using test.iOS;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly: ExportRenderer(typeof(MyCollectionView), typeof(MyCollectionViewRenderer))]
namespace test.iOS
{    
    public class MyCollectionViewRenderer : CollectionViewRenderer, IUICollectionViewDelegate, IUIScrollViewDelegate
    {
        protected override void OnElementChanged(ElementChangedEventArgs<GroupableItemsView> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                NSArray views = Control.ValueForKey(new NSString("_subviewCache")) as NSMutableArray;
                UICollectionView collectionView = views.GetItem<UICollectionView>(0);

                var oldDelegates = collectionView.WeakDelegate;
                collectionView.Delegate = new MyCollectionViewDelegate((MyCollectionView)Element);

            }
        }  
    }

    public class MyCollectionViewDelegate : UICollectionViewDelegate
    {
        MyCollectionView customView;

        public MyCollectionViewDelegate(MyCollectionView collectionView)
        {
            this.customView = collectionView;
        }

        [Foundation.Export("scrollViewDidEndDragging:willDecelerate:")]
        public void ScrollEnded(UIKit.UIScrollView scrollView, bool willDecelerate)
        {
            Debug.WriteLine("Finished Scrolling");

            customView.RaiseScrollEnded(customView, willDecelerate);
        }
    }
}

How to implement material outlined Textfield with trailing icon in Xamarin.Forms

I have been trying to implement material visual for my app in Xamarin Forms. Right now i am focusing on outlined textfield with trailing icon. I have looked into customrenderer, but could not find any answer in Xamarin documentation, forums or any nuget package. Any help in this regard will be highly appreciated.

Viewing all 81910 articles
Browse latest View live


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