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

How to display the data in table format.

$
0
0

I want to display the data in table structure like shown in attachment. I want Table Header as constant and the data will scroll.

Thanks..


iOS11 large titles in XAML

$
0
0

In reference to this post on the Xamarin blog: https://blog.xamarin.com/making-ios-11-even-easier-xamarin-forms/

I have set up what I think should be a proper ContentPage to use safe areas and large titles on NavigationPages in XAML (not exactly the topic of the post but I think I have the right idea).

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MyApp.Pages.MyPage" Title="Summary"
             xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core" 
             ios:NavigationPage.PrefersLargeTitles="true"
             ios:Page.UseSafeArea="true">

The page is invoked in C# like so:

Application.Current.MainPage = new NavigationPage(new SummaryPage());

The safe area works great, but the large titles don't display. Can you tell what I'm missing? I've read I should be able to do everything as a content page that I would do as a Navigation page, unless I'm misunderstanding: https://forums.xamarin.com/discussion/17704/navigationpage-in-xaml

FFImageLoading is Not Loading Image From App Sandbox in Xamarin.Forms UWP

$
0
0

I am using a Xamarin.Forms UWP app that has image "myicon.png" downloaded to its sandbox location. It's path is like below and I can see it and in Windows Explorer and open the image in MS Paint for example. That prooves that the image exists in the App Sandbox:
"C:/Users/me/AppData/Local/Packages/f040f23f-de21-4722-832d-7b617ef7fbe1_16fy7p00psw5z2/LocalState/se/resources/resources/plugins/spseplugin/myicon.png"

So, the image is not added to project structure (neither PCL nor UWP) but it is available in the app sandbox location.

I am trying to load that image and show it in StackLayout in my UWP app using FFImageLoading library for performance reason as it does image caching. In order to do so, I am doing following:

  1. I have downloaded Nuget for FFImageLoading and it is added to my references
  2. In UWP App.xaml.cs, I added following as per FFImageLoading GitHub documentation instructions:
                        var assembliesToInclude = new List<Assembly>()
                        {
                            typeof(CachedImage).GetTypeInfo().Assembly,
                            typeof(CachedImageRenderer).GetTypeInfo().Assembly
                        };
                        Xamarin.Forms.Forms.Init(e, assembliesToInclude);
  1. In my UWP MainPage.xaml.cs, I added following line in MainPage c-tor just after call to InitializeComponent, also as per FFImageLoading GitHub instructions:
    CachedImageRenderer.Init();

  2. Add xmlns namespace for FFImageLoading library in my XAML:
    xmlns:ff="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"

  3. Add FFImageLoading CachedImage to my StackLayout:

        <ff:CachedImage       <-- using CachedImage wont show image. Using Image will show it.
          Source="{Binding ImageUri}" 
          WidthRequest="20" 
          HeightRequest="20" 
          VerticalOptions="Center" 
          DownsampleToViewSize="True" />

Above, ImageUri is a property on my view-model and putting break point on it shows that it is set to the image file path I showed above.

Using FFImageLoading CachedImage however is not showing the image when I run my app whereas Image (Xamarin Image View) is showing it fine.

SDK Changed Application not running

$
0
0

Plz help me
when i changed the SDK version and run the application getting the execution failed message.

Xamarin.Forms App Crashing On Click Event Handler

$
0
0

Hi
I have created a small app using Visual Studio for Mac for iOS with Xamarin Forms. It has three XAML pages. Since this application intends to send message which can not be accomplished using simulator, therefore, I tried using Xamarin Live on my iPhone. The application is installed and shows OK on iPhone Xamarin Live but when I tap on a button on home page it takes us to Message page exactly as intended. There is a send message button on the Message page, when this button is clicked an exception shows up stating 'Uncaught Exception: The index was out of bounds of the array (IndexOutOfRangeException)'. It appears as if it is a problem with page stack, but unfortunately, I am not able to nail it down. Below is the code.

Click Handler on the Home Page

       if (xMessagePage == null)
            xMessagePage = new xMessagePage();
        try
        {
            await Navigation.PushAsync(xMessagePage);
        }
        catch(Exception ex)
        {
            DisplayAlert("BtnMessage_Clicked", ex.Message, "OK");
        }

Click Handler on the message page which tries to bring up the UIActivityViewController

    public void BtnMessage_Clicked(Object sender, EventArgs eArgs)
    {
        uMessageController umc = new uMessageController();

        try
        {
             umc.SendTextMessage("en-us", eMessageType.Text);
        }
        catch(Exception ex)
        {
            uShareMessages.ShowMessageBox("Message_Clicked", ex.Message);
        }
        finally
        {
        }
    }

void uMessageController::SendTextMessage(string strTextMsg, "en-us", eMessageType.Text)
{
try
{
string strDefaultMsg = "MyTest Message1"
string strDefAttachmentName = "NYC";
if(string.IsNullOrEmpty(strTextMsg))
strTextMsg = strDefaultMsg;
string strTextMsg1 = uShareMessages.GetMessageString(strCulture);
string existingSound = NSBundle.MainBundle.PathForResource(strDefAttachmentName, "mp3");

            var remFileUrl = NSUrl.FromFilename(existingSound);

            lstMessageItems = new System.Collections.Generic.List<NSObject> { new NSString(strTextMsg1 ?? string.Empty) };
            lstMessageItems.Add(remFileUrl);
            UIActivityViewController avController = new UIActivityViewController(lstMessageItems.ToArray(), null);

            avController.ExcludedActivityTypes = vcActivitiesExcluded;
            avController.CompletionWithItemsHandler = ActivityViewController_CompletionHandler;
            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(avController, true, null);

        }
        catch(Exception ex)
        {
            uShareMessages.ShowMessageBox("SendTextMessage", ex.Message);
        }

}
Thanks in advance,
Paraclete

Picker in ListView

$
0
0

I have picker in each row of listview. How to get value of picker as well as from which row it is selected in Xamarin.Forms

How to Image Processing within a Box or Frame?

$
0
0

Hi,

I have an app which requires items photos.

The item photo must 300wx200h

I am just starting with Xamarin images and needs guide please..

How can I allow user to take a photo from camera {OR SELECT FROM DEVICE ALBUM} and then position the photo inside the box/frame by reposition or by cropping?

Thanks,
Jassim

how would i show images in thumbnail view please someone help me

$
0
0


see the image ,as shown like in image i need in my pcl project ,thank you


Adding rows to a grid using MVVM

$
0
0

On a page where I am displaying a receipt to a user, I have a section which lists the subtotal, any taxes, and the total. Since the taxes applicable vary by region and based on the products being sold, the number of rows in this section will vary. For example, here are 3 separate orders, one with GST and PST, one with just GST, and one with neither:



I've accomplished this by putting just the SubTotal in the grid in XAML, and adding the rest in the code-behind in a method I call from the ViewModel. However, I'd really like to avoid doing it this way, so I'm wondering if there is an approach to accomplishing this which doesn't require having a bunch of code in the View's code-behind. I'd like to do this while keeping the columns nicely aligned as if they were in a single grid, and without adding any weird spacing between the rows.

app crash in device and not in simulator

$
0
0

Can anyone Please help me on this My app is running on the simulator is working fine but not in device keep on getting the crashes. May I know what is the issue am facing with?? Please help me.

Thanks.

Load more items without button click

$
0
0

Dears,

I am implementing load more items to listview without a button.

My code:

 public partial class DashBoardPage : ContentPage
  {
    ObservableCollection<string> Items;
    bool isLoading;

    public DashBoardPage()
    {
        InitializeComponent();

        Items = new ObservableCollection<string>();
        var listview = new ListView();

        listview.ItemsSource = Items;
        listview.ItemAppearing += (sender, e) =>
        {
            if (isLoading || Items.Count == 0)
                return;

            //hit bottom!
            if (e.Item.ToString() == Items[Items.Count - 1])
            {
                LoadItems();
            }
        };
        LoadItems();
    }

    public async void LoadItems()
    {
        isLoading = true;
        HttpClient client = new HttpClient();
        var response = await client.GetAsync("My Url");
        string tweetJson = await response.Content.ReadAsStringAsync();

        UserTweetResponse userTweetResponse = new UserTweetResponse();
        if (tweetJson != "")
        {
            userTweetResponse = JsonConvert.DeserializeObject<UserTweetResponse>(tweetJson.ToString());
        }
        ListView1.ItemsSource = userTweetResponse.userTweetsList;
        isLoading = false;
    }
}

I refer the following link and confused with the for loop inside LoadItems():
https://montemagno.com/load-more-items-at-end-of-listview-in/
for (int i = 0; i < 20; i++)
{
Items.Add (string.Format("Item {0}", Items.Count));
}
In my case I am using itemSource property to bind the response to list view.
How can I fix this?
Thanks in advance :)

Metadata dll could not found.

$
0
0

Unable to debug the solution.please help me out

DatePicker Translation

$
0
0

Hi,

In my app, we are managing different languages that are independent from the device language.
In a simple page, we have a DatePicker control and we want it to be translated in a specific language (user's choice).
The problem is not concerning the date format of the entry but actually the texts in the dialog like the month or the day.

I've tried some tricks setting CurrentCulture, CurrentUICulture or ThreadCulture but it doesn't seem to work.
For instance, my device is in english but my app is in french and the DatePicker is still showing the date like 'Sat 4 May' .

Is there any solution for this ?

Thanks,
Fabien.

MasterDetailsPage Menu Icon not showing up on iOS

$
0
0

Hi all,

I have an app with a MasterDetailsPage that I use for the main navigation. I am using the "hamburger" icon for my menu icon. On Android this works great. I set the Icon property on the MenuPage which is a ContentPage. And the "hamburger" appears. But on iOS nothing shows up no matter what I do. Anyone have any advice on what might be wrong or how to fix this?

Click on map overlay

$
0
0

Hi,

I am looking to create a Xamarin Forms app where i have to show the map and draw some circle overlays to it. I'm able to draw the circles using the samples provided by Xamarin. However I am not sure how can I raise a click event when user clicks on the circle. On click of a circle I need to open up a popover window to display some information.

I am new to Xamarin and not sure how can I can do that. Any help?


Images not always showing

$
0
0

I'm making a game and I've noticed that images do not always display its imagesource. This seems to happen more frequently. I have all images set as Embedded with copy if newer in my project. My project now contains **578 **embedded images. I'm always using the normal Image component.

I get the images with this code:

    public static ImageSource GetImage(Images name, ImageType imgType)
            {
                string key = "PartyTime.Resources." + imgType.ToString() + "." + name + ".png";

                try
                {
                    if (m_Images.ContainsKey(key)) return m_Images[key];

                    ImageSource img = ImageSource.FromResource(key);

                    m_Images.Add(key, img);

                    return img;
                }
                catch (Exception ex)
                {
                    Classes.Globals.Log("GetImage(2) Ex: " + ex.ToString());
                    return ImageSource.FromResource(key);
                }
            }

I cant post images yet with this new account so I'll try to explain it with symbols below. Consider each [tile] as an image. Sometimes an image does not show the image assingned to the imagesource:
[tile][tile][tile][ ][tile]

Any suggestions would be greatly appreciated.

How to make the dynamic grid view and make it clickable?

$
0
0

Is there a way to dynamically create a grid's from the List and make it clickable on the PCL project using mvvm?

Problem when i try to install Plugin.Firebase.PushNotification

$
0
0

I get started a new Project from scratch. When i went try to install the plugin(Firebase.PushNotification) i was not getting to install in the Android Project. The error is: You are trying to install a package which is designed to MonoAndroid only Version=v7.1. I uninstalled all package and i went installing one by one. PCL and IOS, is ok, but android not. Why?

how to save multiple Entry.text or Label.Text for reassign to an other Entry.Text

$
0
0

Hi all,
habitually for this step i use in C# two List<> and a double loop.

I add Label.Text in a List:

List mytext = new List();
mytext.Add(Label.Text);

I group my Controls in a List:

List myEntry = new List();
myEntry.Add(Entry);

And i reassign a string with double loop:

foreach (var S in myEntry)
{
foreach (var e in mytext)
{
S.Text = e
}
}

but it does not work in Xamarin.Forms
I create dynamiclly the Entry, i save a TextValue for each Entry, I modify a number of Entry and i reinject a Value.Text.

Can you helpme please ?

Thx

"hit area" to image gesture recognizer not accurate

$
0
0

I have a strange behavior of tap gesture to an Image. A tap work, no problem.

But the "hit area" overflow to image and include a Parent....

I test in a grid or stacklayout, or frame, with widthrequest for a large native image or resize in photoshop my image to make it smaller... without success.

Curiously on some page hit area is correct, and other page include Parent...

Have you ever had this behavior ?

ps: i work in abolutelayout, format image is PNG, not test for the moment inputTransparent to the parent

Viewing all 58056 articles
Browse latest View live


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