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

Is There A Cross-Platform App Sizer?

$
0
0

Given all the platforms support non-phone devices, is there a cross-platform app window sizer function that can be used for the wide variety of devices that have screens larger than phones? A sizer that would allow the app to create its window as a downsized window?


Adding Embedded Image Using Markup Extension/assembly for ContentProperty?

$
0
0

Hi Guys,

I'm using VS2019 on a Mac. Adding my first embedded image. My compiler has a big red line under the [ContentProperty? It says I'm missing an assembly or something? Under Add/Reference I added System.Xaml.dll (there were like 7 versions on the system?) but still no joy. I appreciate any help you can give me!

Thanks,
Brett

Error when building is -
/Users/davis/Projects/MyImageApp/MyImageApp/ImageResourceExtension.cs(6,6): Error CS0246: The type or namespace name 'ContentPropertyAttribute' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (MyImageApp)

My code -

using System;
using System.Reflection;
using Xamarin.Forms.Xaml;

namespace MyImageApp
{
[ContentProperty(nameof(Source))]
public class ImageResourceExtension : IMarkupExtension
{
public string Source { get; set; }

    public object ProvideValue(IServiceProvider serviceProvider)
    {
        if (Source == null)
        {
            return null;
        }

        // Do your translation lookup here, using whatever method you require
        var imageSource = ImageSource.FromResource(Source, typeof(ImageResourceExtension).GetTypeInfo().Assembly);

        return imageSource;
    }
}

}

Scroll in listView

$
0
0

Hi,

I have a listView where the number of items depends on someones input. In some cases, there are not many items so all items in the list are visible. In other cases however, the number of items exceeds the limit of list items to be seen, so the user should be able to Scroll the list to see every item.

Adding the code here does not seem to work..

Thus two questions:

  • How to scroll in a listView (including a scrollbar)? I can't figure out how to do that.
  • Is it possible that the scrolling and scrollbar will only be enabled when there are too many list items?

I hope someone can help.

Regards, Ganesh

Set and get element by name in code behind or maybe another suggestion

$
0
0

So i have a List of MyModel which has hierarchical structure.

public class MyModel{
public int Id { get; set; }
public string Name{ get; set; }
public int ParentId{ get; set; }
}

I wanted to a create a simple hierarchical layout. So i used this method.

        private void CreateLayoutsHierarchical(List<MyModel> myModelList)
        {
            Dictionary<int, StackLayout> dict = new Dictionary<int, StackLayout>();
            dict.Add(0, RootLayout); //RootLayout is an empty stack layout in the xaml

            foreach (MyModel myModel in myModelList)
            {
                StackLayout parentLayout = null;
                dict.TryGetValue(myModel.ParentId, out parentLayout);

                StackLayout sL = new StackLayout();
                sL.Orientation = StackOrientation.Vertical;
                Label label = new Label();
                label.Text = myModel.Name;

                sL.Children.Add(label);
                dict.Add(myModel.Id, sL);

                parentLayout.Children.Add(sL);
            }

Well it worked but can i do this differently? Hopefully not using a dictionary? I tried setting and getting elements names(maybe HLayout1, HLayout2,..) in code but is that possible? I couldnt do it?

Scanning App in Xamarin forms using custom renderer

$
0
0

I have to implement a Scanning App in Xamarin forms. I want to use AVFoundation for iOS Google Vision for Android. can you please tell me how to achieve it. I tried ZXing but It is creating issue with some of the QRcode, if it is complex of not clear.

What analytics tools do y'all use?

$
0
0

I am currently only using Appcenter, but curious to hear what folks are using as Analytics tools for Xamarin. Appcenter is a little clunky and doesn't really show analytics data well. Looking for engagement information primarily and demographic data.

How to change the Navigation Page Title font in UWP?

$
0
0

I am trying to use a custom font for my Navigation Page Titles.

I have scratched out the unwanted details. I want to use a custom font for the Navigation Bar title, that reads - "Page Title".
I was able to customize the the tabbed page titles by adding a fontfamily to the TextBlock in PivotStyle.

Is there anyway of writing a similar style for Navigation Page? I am fairly new to UWP and this is my first application.
Also it'll be very helpful if you can even help me with customizing that thin horizontal blue line under the "Tab 1", and disable hover action for the Hamburger menu icon.

So, I am trying to find a solution to 3 problems:
1. Custom fonts for navigation bar title.
2. Change the Tabbed bar, selection color.(The thin blue line)
3. Disable hover action on the Hamburger menu icon.

It is really difficult to find any kind of resource for Xamarin.UWP. Please help. Thanks in advance :smiley:

Not able to override AppBarButtonStyle

$
0
0

So, far I have had major luck in overriding PaneButtonStyle and some single style setters for TextBlocks and SolidColorBrush. The trick is to just redefine them in App.Xaml with the same x:key as the original style. Now, I tried the same with AppBarButtonStyle with this: https://stackoverflow.com/a/55470551.

Is there a way to override it with a custom renderer as well, like done here: https://forums.xamarin.com/discussion/151174/can-not-override-pivotheaderitem-uwp#latest, for TabbedPageStyle??


Gmail Authentication in Xamarin forms

$
0
0

How to do gmail authentication in xamarin forms apps after shutdown google plus API. I found some of the tutorial on internet but all of are did using google plus api but which is not support now. Other tutorial little bit confusing for me to implement in my apps. Anyone can tell me how can i do this.

Thanks in advance.

Check the version and download the app

$
0
0

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 ?

$
0
0

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

$
0
0

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

$
0
0

Is installed emulator android 4.3
but not start

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

$
0
0

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?

How to add a missing Event to CollectionView

$
0
0

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

$
0
0

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.

Is There A Cross-Platform App Sizer?

$
0
0

Given all the platforms support non-phone devices, is there a cross-platform app window sizer function that can be used for the wide variety of devices that have screens larger than phones? A sizer that would allow the app to create its window as a downsized window?

Xamarin.Forms, MVVM and MVC

$
0
0

I'm new to Xamarin.Form. What does folks generally use in Xamarin.Forms apps - MVVM or MVC? I know MVC in asp.net environment. I see so many references to MVVM in Xamarin.Form than MVC in Xamarin.Forms, is MVVM a preferred architecture in Xamarin.Forms? Is it true that in MVVM, controller is replaced by VM?

Hoping someone will shed some light.

activityindicator center screen

$
0
0

hi

How do you keep floating in the middle of the screen icon
My page height is high

HttpClient.GetStringAsync(url) halts and time out in ios only

$
0
0
     it is working fine with Android but when i tried it with IOS it halts and no return value and it gives error of time out ,

any clue please .

var client = new HttpClient()
var url = "http://" + Parameters.IISServer + Parameters.Port + "/api/Synchronization/GetRegistredPhonesApp?PhoneNumber=" + Parameters.SerialNumber;
var result = await client.GetStringAsync(url);
var registredPhonesList = JsonConvert.DeserializeObject<List>(result);

Viewing all 81910 articles
Browse latest View live


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