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

How do I put the flyout item(Exit) at the bottom of the menu?

$
0
0

Hi everyone !

I want to put shell content at the bottom of my shell menu. How do I do this? I would also like to show popup when the user clicks on logout. But the application fails. Note : local: AcoountExit ==> PopupPage

    <FlyoutItem Title="Anasayfa" FlyoutDisplayOptions="AsMultipleItems" Style="{StaticResource BaseStyle}" Icon="ic_action_home.png">
        <ShellContent Title="Kampanyalar" Icon="ic_action_home.png" ContentTemplate="{DataTemplate local:MainCampaing}" />
        <Tab Title="Harita" Route="Harita" Icon="ic_action_location_on.png">
            <ShellContent Route="Harita" Style="{StaticResource BaseStyle}" Title="Harita" Icon="ic_action_location_on.png" ContentTemplate="{DataTemplate local:MapPage}" />
            <ShellContent Route="Liste" Style="{StaticResource BaseStyle}" Title="Liste" Icon="ic_launcher.png" ContentTemplate="{DataTemplate local:MapListPage}" />
        </Tab>
        <ShellContent Title="Barkod" Icon="ic_action_center_focus_weak.png" ContentTemplate="{DataTemplate local:BarcodePage}" />
        <ShellContent Title="Alışveriş" Icon="ic_action_shopping_cart.png" ContentTemplate="{DataTemplate local:WebSite}" />
        <ShellContent Title="Profil" Icon="ic_action_account_circle.png" ContentTemplate="{DataTemplate local:ProfilePage}" />
    </FlyoutItem>
    <FlyoutItem Title="Hizmetler" Icon="ic_action_center_focus_weak.png" Style="{StaticResource BaseStyle}" FlyoutDisplayOptions="AsMultipleItems">
        <ShellContent Title="Markalarımız" Icon="ic_action_style.png" ContentTemplate="{DataTemplate local:BrandsPage}" />
        <ShellContent Title="Alışveriş" Icon="ic_action_shopping_cart.png" ContentTemplate="{DataTemplate local:WebSite}" />
        <ShellContent Title="Hakkımızda" Icon="ic_action_center_focus_weak.png" ContentTemplate="{DataTemplate local:AboutUs}" />
    </FlyoutItem>
        <ShellContent Title="Çıkış Yap" Icon="ic_action_style.png" ContentTemplate="{DataTemplate local:AccountExit}" />

Custom Page Transitions with Xamarin.Forms?

$
0
0

Is it possible to override the default Page Transitions for Xamarin.Forms when calling PushAsync or PushModalAsync?
For example, I would like to have slide or fade transitions for Android.

I have tried extending the NavigationRenderer and overriding OnPushAsync, but I can only control the animation of the pushed page and not the current page.

Consuming Android and iOS libraries

$
0
0

I need to consume a BT library from a third party. They provide an Android and iOS library. I have created native binding libraries for both and referenced those in my Xamarin forms project. Does anyone know of any examples of doing the wrapper interface?

Display folder list in Xamarin

$
0
0

In Xamarin, I want to create a folder list for Android and iOS as below,
I get an error when I enter the path.
Are the following things impossible on Android / iOS?
Dim subFolders As String() = System.IO.Directory.GetDirectories( _ "C:\test", "*", System.IO.SearchOption.AllDirectories) ListBox1.Items.AddRange(subFolders)

Can you please help me?

$
0
0

I create a toolbaritem on my mainpage.xaml.cs:

ToolbarItem tbi = new ToolbarItem();
tbi.Text = "SAVE";
tbi.Clicked += clickSave;
tbi.Order = ToolbarItemOrder.Primary;
tbi.Priority = 1;
ToolbarItems.Add(tbi);

        void clickSave(object sender, EventArgs e)
        {
            ToolbarItem item = (ToolbarItem)sender;
            //item.Text = "Save Doc";
            DisplayAlert("Do", "Doc Saved", "OK");

and it works fine.

I want to put this piece of code on a class, in a different file, and "call" it in the mainpage.
I tried "everything"!!!

thanks in advance and sorry for my bad english

Xamarin.Forms.Forms doesn't exist after updating Xamarin.Forms

$
0
0

I was using this for the following implementations:

Xamarin.Forms.Forms.Init(...)
Xamarin.Forms.Forms.Context.GetSystemService(...)

However, since updating my android project to the latest version of Xamarin.Forms. The Xamarin.Forms.Forms namespace does not exist. Why would you remove a namespace like this? Where is the init method moved to? This is breaking my code and I can't build without this fixed.

ListView Navigation

$
0
0

Hello,
I have a listview and button on a page where the button adds a new item to the list view.
If an item is selected it takes you to a page where the information can be edited.
I would like to know if theres a way to make the application add an item to the listview and then automatically click on it. By click on it I mean I would like it to open the edit page automatically. As right now, it will add the item to the bottom of the list for which you will have to scroll down and tap on the new item to see the edit page.

Code in Front:
<ListView x:Name="ContactsView" ItemsSource="{Binding ViewModelObjects.Contact.DisplayObjects, Mode=TwoWay}" ItemSelected="ContactItemSelected" Grid.Row="1"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Label Text="{Binding FirstName}"/> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

Code Behind:
`
void AddContactButtonClicked(object sender, EventArgs e)
{
contactViewModel.NewContact();
}

    async void ContactItemSelected(object sender, SelectedItemChangedEventArgs e)
    {
        if (e.SelectedItem != null)
        {
            await Navigation.PushAsync(new EditContact(e.SelectedItem as clsContact));
        }
        ((ListView)sender).SelectedItem = null; // Prevents item from staying selected
    }

`

How to prevent pages from navigating Multiple Forms

$
0
0

In Xamarin Forms, I have a list view and on tapping one item in the list view it will be taking us to the next content view. If I am tapping the item in the list view quickly for multiple times we can see the screens are navigated multiple times. How can we avoid it?


How to send file with HttpClient post in xamarin forms

$
0
0

I want to send file through post request using httpclient this what i tried but file didn't sent , when i tried in postman it works fine

string Url = $"http://ataprojects.net/test/products.php?request_type=add&company_name={BaseService.Company}&name={product.name}&barcode={product.barcode}&buy_price={product.buy_price}&sell_price={product.sell_price}";
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    var content = new MultipartFormDataContent();
                    content.Headers.ContentType.MediaType = "multipart/form-data";
                    content.Add(new StreamContent(product._mediaFile.GetStream()),
                      "image",
                       product.image);                    
                    var response = client.PostAsync(Url, content).Result;

                    response.EnsureSuccessStatusCode();
                    if (response.IsSuccessStatusCode)
                    {
                        var contentdata = await response.Content.ReadAsStringAsync();                       
                        var Items = JsonConvert.DeserializeObject<AddProductReturnModel>(contentdata);
                        return Items;
                    }
                    else
                    {
                        return null;
                    }
                }

            }

what's the problem ?

Working with azure maps.

$
0
0

Hi everyone,
I am looking a way to implement the Azure maps in my APP. I want to show geofencing with azure maps . There will be a location which needs to be marked as Home/Safe. I have gone through this link but didn't find such way
https://github.com/AlexPshul/XaMaps

and

https://github.com/Azure-Samples/AzureMapsCodeSamples/tree/master/AzureMapsCodeSamples

but didn't find the exact way to implement Polygon and Geofencing with the help of azure maps.

As shown in the screenshot, I have to implement exactly same.

How to connect to MS SQL

$
0
0

hi guys, can you help me on how to connect to MS SQL. i have tried mysqlconnector but i think it's not compatible to MS SQL as i have connection error. i tried creating a sample MYSQL and it works fine.

Get elements by class?

$
0
0

Probably there is an easy solution to this.

                        <AbsoluteLayout x:Name="absLayout1">
                            <Image x:Name="absLayout1Image" Source="somaimage.png"></Image>
                        </AbsoluteLayout>

I want to align this image in absLayout1 programmatically like this.

            absLayout1.Children.Add(
                absLayout1Image,
                new Rectangle(0.5, 0.5, 0.7, 0.7),
                AbsoluteLayoutFlags.All
            );

Now i have 20 of this AbsoluteLayouts exactly like this. There is an image in absolutelayout... And i want to position the image with the same rectangle. I dont want to give each absolutelayout a name and write a repetitive code. Can a give this absolutelayouts a class and in xaml.cs select them by this class and get image in it to write the code above?

Switch between Segmented control tabs

$
0
0

Hi,
I am using SegmentedControl.FormsPlugin for segmented control functionality.

I am able to switch from one tab to another as expected.

Ex: I have 2 Segmented control tabs "Tab1" and "Tab2"
When I switch from Tab 1 to Tab 2 it will navigate as expected. now when i navigate from Tab 2 to other screen of application and again navigate back to segmented control screen i want "Tab 2" to be selected.

what could be the possible reason for this crash, random crash for some of the users only. any help?

$
0
0

Enumerable.ElementAt[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Int32 index)
ListView.NotifyRowTapped (System.Int32 groupIndex, System.Int32 inGroupIndex, Xamarin.Forms.Cell cell)
ListViewRenderer+ListViewDataSource.RowSelected (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath)
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate)
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName)
Application.Main (System.String[] args)

What is the property in control to be set to get the value from AppResult.Text in Xamarin.UITest?

$
0
0

I am trying to create custom control in Xamarin.Forms which has the unique automation id for automation. So, i have set the android renderer's contentDescription property. So, i can get the AppResult.Label property to identify the control. But, my requirements is that how to get the control's text property? What property i have to set in control level with the corresponding text to get it in AppResult.Text property.

[Test]

[Description("SampleTest")]

public void WelcomeTextIsDisplayed()

{

App.Repl();

AppResult[] results = App.WaitForElement("myControl");

Assert.IsTrue(results[0].Text == "My Control Text", results[0].Text + "\n" + results[0].Description + "\n" + results[0].Id + "\n" + results[0].Label);
}


How to set a classname to the StyleClass by {Binding ...} from code behind

$
0
0

Hi, i need to set a class name to the StyleClass dynamically

Ctmlst.Add(new CtrMemCat()
{
FrClass=fr
}
this is in a for loop and when the page get load in this step exception thrown (NullReferenceException)

Crash using Crossmedia Plugin to upload image

$
0
0

Dear Experts,

I'm using the Crossmedia plugin to upload a photo from my device's gallery to a server. Everything works fine the first time, meaning I get the dialog asking for permission and the upload actually happens. However, the very next time i attempt to upload a photo, it crashes. I believe I have the correct keys set in info.pList but haven't quite found a reason for it...Has anyone experienced this before?

Many thanks in advance!

percy

Released to testflight but not displaying in testflight application

$
0
0
  1. Actually am using one old application built in Xamarin IOS native till (1.1 vv build no 10) and now i have developed in Xamarin forms by new project in VS 2019 with same distribution certificates,

  2. So my issue is when am releasing to test flight it's uploading to test flight at Apple developer account successfully without any issue but not displaying in test flight application in mobile and under invitations its not displaying any thing.

Thanks in advance.

Set different external storage path for xam.plugin.media?

$
0
0

I would like to save the photos in the private folder of the application (android/data/com.companyname...) on the SD card and not on emulated/0/Android/data/... Is it possible to change this parameter or do I have to create my own custom camera?

I get the path from Context.GetExternalFilesDirs list

Thanks

Use a custom render to preview and to take a photography in Xamarin Forms

$
0
0

I create a custom render, This allow me to have a preview of the camera into Xamarin forms in IOS and Android.

But i need take a photography, can you help me to take the photography from the selected scene in the form?

Viewing all 81910 articles
Browse latest View live