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

Re-Highlight CollectionView SelectedItems?

$
0
0

Hello, I have been struggling to make my inventory lists maintain consistent highlighted items when using a SearchBar or sometime navigating away from the page. I see this great looking sample from the MS Docs' "Xamarin.Forms CollectionView Selection : Multiple Pre-Selection" (I can't post links here, yet)

<CollectionView x:Name="collectionView"
                ItemsSource="{Binding Monkeys}"
                SelectionMode="Multiple"
                SelectedItems="{Binding SelectedMonkeys}">
    ...
</CollectionView>


namespace CollectionViewDemos.ViewModels
{
    public class MonkeysViewModel : INotifyPropertyChanged
    {
        ...
        ObservableCollection<object> selectedMonkeys;
        public ObservableCollection<object> SelectedMonkeys
        {
            get
            {
                return selectedMonkeys;
            }
            set
            {
                if (selectedMonkeys != value)
                {
                    selectedMonkeys = value;
                }
            }
        }

        public MonkeysViewModel()
        {
            ...
            SelectedMonkeys = new ObservableCollection<object>()
            {
                Monkeys[1], Monkeys[3], Monkeys[4]
            };
        }
        ...
    }
}

However, I'm not assigning by index numbers... really I'm just trying to say:

SelectedMonkeys = SelectedMonkeys ;
_ SelectedMonkeys are still SelectedMonkeys _

But how do I make that work? I tried this without success:

SelectedItems="{Binding SelectedMonkeys, Mode=TwoWay}"

Thanks!


Xamarin: Vertical alphabet Indexing (Jump List) for grouped list in xamarin forms for droid and win

$
0
0

I have followed this list view with group header sample. It works fine. The IOS by default provides the "Jump list" feature in the form of vertical alphabet index. But this is not available on android and windows. Android has "fast scroll" feature, but does not provide a vertical alphabet index same as IOS. For this, I find that it requires custom rendering. I am facing problem while custom rendering. How can I provide the same "Jump list" feature as of IOS to android and windows for a grouped list view as shown below?

Same post on stack overflow.

Alphabet Scrollbar In Labeled Sections Listview ala iOS Contact List

$
0
0

Hello,

I'm wondering if it's possible to make an alphabet scrollbar in a listview that has alphabetical labeled sections like the iOS contact list:

image

I know I can use the build in control for iOS, but what about windows phone and android? Do I have to create a custom control for those platforms?

Any help appreciated!
-Brett

How to draw a textured rectangle?

$
0
0

Now that we have SkiaSharp, Shapes etc., how would one go about replacing a colored BoxView with a colored and textured block, to run on Android, iOS and UWP?

For those users who are color-blind, but who do not want to use VoiceOver etc., it would be good to be able to replace the use of colored blocks where the color used represents a particular meaning/state, replacing them with textured blocks where a different texture is used depending on meaning/state. How would one go about including such textured blocks in a XF UI?

Images not appearing for Windows UWP in release mode.

$
0
0

I'm experiencing an issue where images do not appear. This happens ONLY in release mode and only for the UWP app.

I have tried:

  • accessing the images as Embedded Resources in the app project. This works in debug mode but not in Release.
  • accessing the images as Content, build always. This works in debug but not in Release.
  • using the built in Image control as well as FFImageLoading, with the same result- works in Debug but not in Release.
  • this seems to be regardless of the image container/ layout, it affects every image in the app.

Images work as expected for Android and iOS. I an using XF version 2.3.1.114.

Does anyone have any advice on this issue, or can you refer to an issue in Bugzilla?

Xamarin.Forms UWP ImageRessources issue

$
0
0

(I'm sorry for my crappy english I'm French)
Hello , I have an issue with ImageRessources from Xamarin.Forms on my MainPage.xaml.g.cs InitializeComponent, on the line this.LoadFromXaml(typeof(MainPage));

i have this exeption :
'System.MissingMethodException' in Xamarin.Forms.Xaml.dll
Method not found: 'Xamarin.Forms.ImageSource Xamarin.Forms.ImageSource.FromResource(System.String)'.

when i delete this line : from my MainPage.xaml i have no problem but i need this line.

I have this exception problem only on UWP and not on iOs or Android

Thank you for your time.

UWP release build causes runtime errors

$
0
0

When I configure my UWP app to build on release it compiles fine, but during runtime I receive lots of exceptions:

Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Exception thrown: 'System.PlatformNotSupportedException' in System.Private.Interop.dll
Exception thrown: 'System.AggregateException' in System.Private.Threading.dll

Why is this happening? And what should I do to resolve this problem?

Is ImageSource.FromResource() working for UWP ?

$
0
0

The call of ImageSource.FromResource() from a UWP application

var imgSource = ImageSource.FromResource(resourceName);

throws the following exception:

Exception thrown: 'System.Reflection.TargetException' in System.Private.CoreLib.dll

On Android and iOS it works fine. The ImageSource.FromResource() call is located in a NetStandard 2.0 class library, the application uses the latest Xamarin.Forms release. Is there any workaround necessary to get it working on UWP (Windows 10 Fall Creators update) ?


Image as Embadded Ressource shows "operation is not supported on this platform" in UWP and Release

$
0
0

This line throws the error:

Image = ImageSource.FromResource("Retailer.Images.background_market.jpg");

In Debug Mode this works perfectly...

How can I fix this Problem?

XF App publishing to Google Play documentation is not clear

$
0
0

It is now time for me to publish my Xamarin Forms app to Google Play store and to Apple App store. But the documentation appears to be not updated and very confusing for first timers. I never faced such issues when publishing my Windows Phone apps. This is what I have done so far, starting to publish to Google Play Store.

I was following this doc: Publishing to Google Play.

First did following the steps in:

Of course there was no email to confirm my membership except for a Thank you email for the payment.

Then in my account I created new app and filled the details including the uploading the assets.

Then I created new certificate for my app in VS.

Then tried to follow the following steps:

I am stuck at Steps 1 & 2 above:

  1. In my Google Play Console followed to, All Apps -> Settings -> API Access -> Choose a project to link.
  2. Is this the correct place to follow for the steps 1 & 2 above?
  3. Because it is telling to create or link an existing Google Cloud Project.
  4. Do I have to create a new Google Cloud Project to get OAuth credentials for my Google Play App submission?

Any guidance to an updated documentation or clarifications will be appreciated.

How to use pinch and pan together with CarouselView

$
0
0

Hi,

Preinfo

  • I created a product page with CarouselView using xamarin forms 4.x latest
  • CarouselView contains product images and you can swipe right or left to see images
  • I added pinch container to zoom in product

This part is nonproblematic.

Problem

  • i added pangesture to pinchContainer. Because users want to pan image detail after zoom in
  • But when i add pan gesture to pincContainer, CarouselView swipe feature is not working

Question: How to use pan and pinch together with CarouselView ?

What I ve tried ?

  • I can access CarouselView from pinchContainer onPan handler method - via object sender parameter
  • I handled if scale is bigger than 1, it means user using pinch so a little bit zoom in there. Then i can apply pan
  • If scale is 1, i want to use CarourselView default behaviour; but i could not find how to skip custom pan and trigger default CarouselView event after pan.
  • If you know how to skip pan and apply sender object pan behaviour, it will work for me

Thanks

Menu icon and title not showing on UWP, works on Android and iOS

$
0
0

Hi,
I seem to be having a problem when I try to add a TabbedPage to my MasterDetailPage.

Here is the structure of the app

MainPage is MasterDetailPage
Master is a ContentPage with a menu
Detail is a TabbedPage with children

Each child page of the TabbedPage is wrapped in a NavigationPage.

On my TabbedPage, I am adding tabs like this:

    public TabbedNavPage()
    {
        InitializeComponent();

        // Set pages for tabs
        this.Children.Add(new NavigationPage(new CustomersPage()) { Icon = "customers.png", Title = "Customers" });
        //this.Children.Add(new CustomersPage() { Title = "Customers" });
        this.Children.Add(new NavigationPage(new ContactsPage()) { Icon = "contacts.png", Title = "Contacts" });
        this.Children.Add(new NavigationPage(new CalendarPage()) { Icon = "calendar.png", Title = "Calendar" });
        this.Children.Add(new NavigationPage(new TasksPage()) { Icon = "tasks.png", Title = "Tasks" });
        this.Children.Add(new NavigationPage(new EmployeesPage()) { Icon = "employees.png", Title = "Employees" });


    }

On Android and iOS, this works fine, each tab shows the title and icon for the tab, and when I tap on a tab, the navigation bar on the top changes to the appropriate title. The menu button is there and I can open the master view and see the menu.
image

On UWP, its a whole different story
image

Now, If I instead wrap the TabbedPage inside a NavigationPage, and remove the NavigationPages from around the tab pages, then UWP will work and show the icon and title, however, the Title will always be the title of the MasterDetailPage, and not the tab pages (this happens across all platforms)

Any idea what I might be doing wrong?
Here's the code I use to set the content of the MasterDetailPage:

    // Keep reference to the master and detail pages
    private NavigationMenuPage _menu;
    //private NavigationPage _detail;
    private TabbedNavPage _tabs;

    public MainNavigationPage()
    {
        InitializeComponent();

        // Create page instances
        _menu = new NavigationMenuPage();
        _tabs = new TabbedNavPage();
        //_detail = new NavigationPage(_tabs);


        // Set pages
        Master = _menu;
        Detail = _tabs; //_detail;


        // Set the events to handle navigation from main menu
        _menu.Menu.ItemSelected += Menu_ItemSelected;

    }

Xamarin Forms Video Chat Application Possibilites?

$
0
0

Hey all,

I've been doing a lot of browser based WebRTC projects and was wondering if anybody knows a way of doing something similar or can put me on the right lines on what to look for to make a 1v1 or group video chat like this using Xamarin Forms (Android and iOS).

All I can find is people promoting tutorials and examples for these freeish third party systems that you can integrate into like Vidyo.io and Agora.io but ideally I want to avoid all of these like I have done in my browser projects and just use my own stun and turn servers and native tools for video chat.

any guidance or help on this would be appreciated.

Thanks

Meta Data Error

$
0
0


I'm working with the card view module on this project. and for some reason, I'm running into this metadata error and I don't know how to fix it.
Did I delete something?

Caught unhandled exception in MonoBtlsSSlCtx.ProcessHandshake

$
0
0

Since its inception our Android/iOS app has used the following code

ServicePointManager.CheckCertificateRevocationList = false; System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => { if (cert != null) System.Diagnostics.Debug.WriteLine(cert); return true; };

to ignore SSL errors when our app connects to our server with a self-signed certificate.
Recently we've had to upgrade all our tools to VS 2090 Preview 2 in order to be able to build for API 29.
Our Android build runs but generates an error "Caught unhandled exception in MonoBtlsSSlCtx.ProcessHandshake" and our webrequests to
our https server now fail. It appears the validation callback is no longer being called.

What is the solution for this without having to rewrite our communication stuff to the server?

Richard


how to keep the service running when the application is force closed?

$
0
0

how to keep the service running when the application is force closed?

Xamarin Forms iOS SSL Bypass

$
0
0

Hello guys.
I'm Working on a App in which I need to make some HTTP request on a server that uses self signed SSL certificates.
I have implemented Bypass code which is working on Android but isn't on iOS.On Android I implemented an interface of HttpClientHandler but on iOS i have used ServicePointManager
App Delegate
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
Http Request

      HttpResponseMessage response;
            if (Device.RuntimePlatform == Device.Android)
            {
                IHTTPClientHandlerCreationService x = DependencyService.Get<IHTTPClientHandlerCreationService>();
                HttpClientHandler y = x.GetInsecureHandler();
                response = await new HttpClient(y).PostAsync(uri, content);
            }
            else
            {
                ServicePointManager.ServerCertificateValidationCallback += (senderr, cert, chain, sslPolicyErrors) => true;
                response = await new HttpClient(new HttpClientHandler()).PostAsync(uri, content);
            }

Can anyone tell me what am I doing wrong?

font-size: x-large in CSS, causes to crush

$
0
0

I have a simple page :

<ContentPage 
        ....>

    <ContentPage.Resources>
        <StyleSheet Source="Styles/NiceStyleSheet.css" />
    </ContentPage.Resources>

    <StackLayout>
        <Label Text="Hi" StyleClass="NiceClassInCss"  />
    </StackLayout>

</ContentPage>

which uses this NiceStyleSheet.css file:

^ContentPage
{
    background-color:brown;
}

.NiceClassInCss 
{
    font-size: x-large;
    text-align: right;
}

The x-large option cause to the app to crush with this exception:
System.InvalidOperationException: 'Cannot convert "x-large" into System.Double'
It happens in MainPage.xaml.g.cs.

x-large is a legitimate option that visual studio offers me among others, so what's wrong here?

How to change white underline color of top tabbar selection indicator ? (Xamarin Forms Shell Nav)

$
0
0

Hi.

I tried tons of things to change color of top tabbar underline color.
If anyone knows what to do to change that color, please share with me.

I added screenshot image to specify related part.
I created style in AppShell and I used Setter to change item colors but nothing impacted on that underline color.

PS: I already searched the forum, I searched the problem on stckovrflw. It looks like there is no approved and working solution shared yet. For example
I could not see any answer that contains specifying the name of related object; so then we can try specify style for that object; but could not found useful information to solve the problem.

What is causing unexpected motion of a logo on splash screen?

$
0
0

I followed this tutorial to make a splash screen. Key Code:

[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true, Icon = "@mipmap/icon")]
    public class SplashActivity : AppCompatActivity
    {

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
        }

        public override void OnBackPressed() { }

        protected override void OnResume()
        {
            base.OnResume();
            Task startupWork = new Task(() => { SimulateStartup(); });
            startupWork.Start();
        }

        void SimulateStartup()
        {
            StartActivity(typeof(MainActivity));
        }
    }

The result is shown as follow:

I noticed that the logo will 'jump' once on the screen.

In order to avoid this unexpected 'jump' I changed to this method:

Instead of creating a SplashActivity, change the theme of the MainActivity:

[Activity(Label = "xxxx", Icon = "@mipmap/icon", Theme = "@style/MyTheme.Splash", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetTheme(Resource.Style.MainTheme);

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;
    ......
    }
}

It works fine. However it seems easier to crash the app in emulator in the second way. (In the first method the app didn't crash yet)
So what is causing that 'jump' issue? (Probably the startupWork task?) How to avoid it? Is the second way recommended?

Viewing all 91519 articles
Browse latest View live


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