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

How to work with graphics in Xamarin.Forms? I don't want to know about Platform Specific Details!


Xamarin.Forms UWP NavigationPage issue

$
0
0

Hello,

we currently have a problem with Xamarin.Forms and the Universal Windows Platform.

We have a TabbedPage that has 4 ContentPages, all wrapped in a NavigationPage.
On iOS and Android its displayed properly. On UWP its displayed correctly first (there is a binding error to the title colors of the TabbedPage, so the text is displayed with wrong color), but after navigating to the second page and going back to the first page, the NavigationBar (CommandBar on UWP I guess) just disappears.
This continues till the last page, where the CommandBar stays. Whenever navigating to pages 1 - 3, the CommandBar disappears.

Has anyone noticed behaviour like this? It's really weird and sad, because now we have to adjust behaviour for UWP.

Best,
Chris

xamarin forms listview selected item binding into another page listview items source

$
0
0

Dear Respected friends, I am new to xamarin am trying to create project. In that project i have listview in a page. I want to do from that listview selected item binding another page listview. so that everytime i selected an item from list that item should add another page listview. This is requirement i had tried a lot kindly help me...... your answer will be more helpful for me.......

MasterDetailPage - Set focus to entry on Detail page

$
0
0

Hi!

I have a strange issue when trying to set focus to one of the entries on the Detail page.

I set a new Detail page for MasterDetail
mainPage.Detail = new NavigationPage(targetPage);
and on Detail page I use OnAppearing() to set focus to entry
var result = SomeEntryThatIWantToFocus.Focus();
But this does not work for some reason.
Result will equal false and entry is not focused.
If I return from next page in navigation stack back to this one, entry will be focused!

Setting focus on other pages works as expected.

Any ideas? Help would be greatly appreciated.

UWP ToolbarItem TextColor

$
0
0

Hi

I have a Xamarin.Forms app targeting iOS, Android and UWP. When I add some toolbaritems (secondary) and start the UWP on my Windows10 machine. The menu appears (when I cklick on the 3-dots-button), but the text is in white color.

This is because my ApplicationBar (with the title) has a blue background color and a white text.

I know, I can't change the color directly on the toolbaritem. But I thought about a renderer...

But how? Can anybody help me out?

My Renderer:

public class UwpBasePageRenderer : PageRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || Element == null) return;

            Loaded += OnLoaded;
        }

        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var mypanel = ContainerElement as Panel;

            // Something like this...
            // mypanel.ApplicationBar.TextColor = Black;

        }
    }

Loaded/Unloaded events for Views

$
0
0

I need to know inside a control that inherits View once it is shown on screen or removed. Currently I can do it manually or recursively using a helper function. I looked into the base classes and it appears that there is no such thing as Loaded/Unloaded or Activated/Unactivated event.

Has anyone had the same need and managed to solve this?

How to read image files using PCLStorage in Xamarin Forms on an Android?

$
0
0

Hi,
From within myApp I used XAM.Plugin.Media to take some pictures and store them in a new directory.
Using FileManager on the Android, I can navigate to the directory and open the pictures. It is something like:
Android/data/myApp.Droid/files/Pictures/myMobile/Project/SubName/

Using PCLStorage code from within myApp when I run:

IFolder rootFolder = FileSystem.Current.LocalStorage;

rootFolder has a path of: /data/data/myApp.Droid/files

Next I try to list all the folders that are one level below rootFolder by doing:

IList LF = await rootFolder.GetFoldersAsync();

it results in two folders:
/data/data/myApp.Droid/files/. __ override > __
/data/data/myApp.Droid/files/.config

I was expecting to get:
/data/data/myApp.Droid/files/Pictures

Any guidance on this topic is appreciated.

Memory leak

$
0
0

Hi! I have a following problem... At one point of workflow in my app I have this case there is some pages on stack and then I add 3 pages with listview, then 2 pages with just buttons and a few small images, and after that I return to first page with listview of this 3 that I've mentioned and I return to that page as I go through navigation stack and remove pages with Navigation.RemovePage(Page) until I come to first page. This listviews don't show images, only text. But problem is that memory doesn't get reduced when I go back, it's like pages stay in memory after removing and that leads to out of memory exception.
When I put Content = nullin on disappearing method in every page, memory increase gets reduced about 2/3 but it's increasing?
Any idea what should I do here?


pass both string and list as content to HTTPClient

$
0
0

Hello All,

I want to call API that has multiple values of strings and multiple lists.

dynamic values = new Dictionary<dynamic, dynamic>();
  values.Add("DocId", _DocId);
  values.Add("UserName", _UserName);
  values.Add("Address", _Address);
  values.Add("education", _education);  // here, _education and _awards are lists. and _DocId, _UserName and _Address are strings.
  values.Add("awards",_awards);
  var content = new FormUrlEncodedContent(values);

I pass Content to httpClient.PostAsync() method with url. Now problem is when I pass list as content it gives error of not supporting datatype. What is wrong in this ?

Any help would be appreciated.

Thank you.

How to add steps to my slider?

$
0
0

Hi ppl! I have a simple slider on my xaml

<Slider
       x:Name="DesSlider"
       Minimum="0"
       Maximum="5"
       Value="0"
       ValueChanged="DesSlider_OnValueChanged"
       VerticalOptions="CenterAndExpand"/>

How can i add steps to it ? I would like the StepFrequency=1 (so totally 5 steps). Is that possible without using any extra nuget packages? Thanks

Best way to display dynamic text on bitmap image

$
0
0

Hi,
I'm a complete newbie to mobile development, so please bare with me.

I've designed a Xamarin Forms Cross Platform project in Visual Studio 2015 Community Edition (targeting only Android at this point) which is an interface to a CDU (Control Display Unit) in the X-Plane 10 simulator. The app consists of a single page which contains a bitmap image of the CDU unit from a Boeing 737-300. I am using an AbsoluteLayout to position all the buttons on top of the "virtual" buttons on the image. The "virtual display" of the CDU is currently made up of a whole bunch of labels to display the various data elements which is returned from the simulator via the network in real time, so the labels are bound to data returned via a TCP socket.

The app is working 100%, but I'm not happy with the limitations of the text displayed inside the labels... I need more control when displaying the CDU screen text.
Here's a screenshot of my app running on my "cheapo" Acer Iconia B1 tablet...
image

I would like the text to occupy the whole label without any "padding" to the edges of the label. Look at the highlighted line displaying "551"...
I would also like to be able to highlight a subset of characters within a single "view"/label. For example: "MOD RTE LEGS" is the data returned from the sim and I need to display the MOD highlighted and then the rest as normal green text.
I would also like to be able to specify letter spacing and use a custom "monospaced" font.
Here are two images from the actual simulator showing how it should be displayed...
image image

So what are my options? Will it be possible to use the graphics API or maybe even SkiaSharp with custom renderers to handle the display portion of the CDU?

Any help or advice would be greatly appreciated.
Thanks, Jean.

Acessing Android.support.v7.widget.Toolbar through a Android.AppCompat.NavigationPageRenderer

$
0
0

Hello, I have a doubt about Material Design on Android. I used the tutorial on this link https://blog.xamarin.com/material-design-for-your-xamarin-forms-android-apps/ and it worked. But I wrote a Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer and I can not access the Toolbar widget in this renderer. I want to access this widget to add or remove ToolbarItems because in my application these ToolbarItems may be present or not depending on the screen to be displayed. Any ideas?

Simplest way to draw a single pixel on Xamarin Forms ContentPage?

$
0
0

Hi,
maybe with SkiaSharp (in Xamarin Forms) @mattleibow?
Or can i detect touch event and draw a BoxView 1x1? (but i hope drawing 500 boxview will decrease app performance?).
I use SignaturePad, but i have to do it in UWP, and this component doesn't support it.

Thank you for any suggest!

Lewix

Xamarin.Forms.Platform.MacOS

How to do a HTTP Request every few minutes when app sleeps / user leaves app

$
0
0

Hey,

How can I do a HTTP request every 5 minutes, if the user leaves the app / locks his phone or something similar (= if the App is not active on the screen)?
My first (probably stupid) idea was, to put a timer inside the protected override void OnSleep() method, but I am pretty sure that there is a better way.
Can somebody provide me some information / links to get started with that? Even a proper term for this problem would help me :)

Cheers!


NavigationPage.TitleIcon not displaying on android project

$
0
0

I am having problem with NavigationPage.TitleIcon that is displaying my logo.png on my ios project but not displaying the logo on android project.

I have my xaml like below:

<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"
             xmlns:behav="clr-namespace:Uno.Behaviors;assembly=Project"
             x:Class="Uno.Views.Page"
             NavigationPage.HasBackButton="false"
              NavigationPage.TitleIcon="logo.png">
</ContentPage>

and also I have kept the png file in ios Resources and android Resources->drawable directory.

Can anybody help me what I have done wrong there?

How to handle Windows 10 Software back button in Windows 8.1 app.

$
0
0

I want to handle Windows 10 Software back button for my windows 8.1 app. How to do this. Below code is not getting hit when the back button is tapped.

protected override bool OnBackButtonPressed()
        {
            Navigation.PopModalAsync();
            return true;
        }

How to add split function to a label in listview?

$
0
0

I have to bind data which is separated by a comma separator. I need to used split function to one label to bind data and i want to separate it by comma(,). Can any one please tell me about this. Is there any other option to resolve this issue??
here is my sample xaml code...

<ListView.ItemTemplate>





In question label i need to separate data by comma(,)...

I need chip Control Like gmail app

I create a new Xamarin.Forms project,When I want to add a xaml contentpage,but it throw below error

Viewing all 81910 articles
Browse latest View live


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