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

Newtonsoft.Json dynamic exception only in IOS/Device/Release

$
0
0

Hi,

My Xamarin.Forms app throws exception: Microsoft.CSharp.Runtime-Binder.RuntimeBinderException: Cannot apply indexing with [] to an expression of type "Newtonsoft.Json.Linq.Jobject"
This only happens in the iOS release version installed on device (either by Xamarin on my device, or from Apple Store by customers).
It works fine on Android (same code!), also tested on iOS Simulator, both Debug and Release - works fine.

The code is here (2nd line):

dynamic json = JObject.Parse(message);
long time = (long)(json["timestamp"]);

I am using Newtonsoft.Json 11.0.2 (not the latest)

Any idea? Maybe some release mode optimizer removes something what should not be removed?

Thanks


List view selected item get back the orange color on scrolling

$
0
0

Hi,

I am new to Xamarin forms. I have implemented list view with its selected item background color to light gray. It works in all scenario except for the scrolling. Once the selected item scrolled beyond the visible area, it gets its default orange color when it comes back to visible area.

I tried different approaches to resole this but no luck. I have attached the gif file here to demonstrate the issue.

My viewCell Renderer is as below:

    public class CustomViewCellRenderer : ViewCellRenderer
    {
        private Android.Views.View _Cell;
        private bool _isSelected;

        protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
        {
            _Cell = base.GetCellCore(item, convertView, parent, context);
            _isSelected = false;
            _Cell.SetBackgroundColor(Android.Graphics.Color.Transparent);
            return _Cell;
        }

        protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnCellPropertyChanged(sender, e);

            if(e.PropertyName == "IsSelected")
            {
                _isSelected = !_isSelected;
                if (_isSelected == true)
                {
                    _Cell.SetBackgroundColor(Color.FromHex("#E6E6E6").ToAndroid());
                }
                else
                {
                    _Cell.SetBackgroundColor(Android.Graphics.Color.Transparent);
                }
            }
        }

    }

Does anyone encountered such issue?

Any help to resolve the issue is highly appreciated.

Thanks.
Mukesh Jayaswal

Dark Mode

$
0
0

Hello, there is a way to force my app to use light mode? when the iPhone use dark mode some of the controls (entry and navigation bars) turns black and made me interface a little fuzzy.

thx in advance

Is Firebase compatible with Xamarin Forms?

$
0
0

Is Firebase platform compatible with Xamarin Forms?

Audio editing in Xamarin.Forms?

$
0
0

Hello team,

Does anyone have any insight as to whether or not a .net library such as this one could be implemented into a Xamarin.Forms project?

https://www.multimediasoft.com/asoednet/

I am considering developing a Xamarin Audio editor. I have not found any examples online, not sure if anyone has tried this.

Thanks!

Is Firebase compatible with Xamarin Forms?

$
0
0

Is Firebase platform compatible with Xamarin Forms?

Xamarin Forms and Azure Service Bus???

$
0
0

Has anyone had any success integrating Xamarin Forms with Azure Service Bus?

I see there's a REST interface for Service Bus to which I could wire up a Xamarin client, but that defeats the notion of temporal decoupling, which is one of the main features of Service Bus. It also makes it impossible to subscribe to topics.

Splash screen with Version

$
0
0

On my Splash screen, I want to put the App version for both Android and iOS at the bottom


How do I assign a value from a static class to x:String in a resource dictionary?

$
0
0

I want my values in the array to reference static values. How can I achieve this?

Here's how the dictionary looks

   <ContentView.Resources>
            <ResourceDictionary>
                <x:Array x:Key="Values" Type="{x:Type x:String}">
                    <x:String>First</x:String>
                    <x:String>Second</x:String>
                </x:Array>
            </ResourceDictionary>
        </ContentView.Resources>

I want something like:

   <ContentView.Resources>
            <ResourceDictionary>
                <x:Array x:Key="Values" Type="{x:Type x:String}">
                    <x:String Value="{x:Static values:Values.First}"></x:String>
                    <x:String Value="{x:Static values:Values.Second}"></x:String>
                </x:Array>
            </ResourceDictionary>
        </ContentView.Resources>

How to derive from a BasePage with visible views in it?

$
0
0

Hi all,

This is driving me nuts. I'm trying to inherit from a base SettingsPage, and it's not working, and I can't find a single example anywhere of how to do it. All the examples I've found involve inheriting viewmodels, and other non-visual elements. In particular I'm not sure what you do with the "Content=" in the derived page, since the base page already sets "Content=". The MS doco on inheritance says that you don't inherit the constructor, but you can inherit from it using :base().

I've put together a colour-scheme picker (which extends on amporis.xamarin.forms.colorpicker), which I want to use as my base for other settings pages (in apps where I need other settings in addition to colour-scheme). I have a class library CSettings, for which CSettingsPage loads fine if loaded directly (which includes Content=SettingsGrid, which everything is loaded into to begin with) - everything is "public". I then have a TestBed app, and trying to create a TBSettingsPage. At the top I have
namespace TestBed { public class TBSettingsPage : CSettingsPage {...
(and I've referenced the DLL of course), and I've tried the following 3 variations with the constructor...

public TBSettingsPage():base() {}
public TBSettingsPage():base() { Content=SettingsGrid; }
public TBSettingsPage() { Content=SettingsGrid; }

Every time I get...

"Exception thrown: 'System.Runtime.InteropServices.COMException' in Xamarin.Forms.Platform.UAP.dll Error HRESULT E_FAIL has been returned from a call to a COM component." at the Xamarin.Forms init.

...which isn't a very helpful error message. It basically says "that's not right" without telling me what's not right nor how to fix it (Googling it comes up with a whole variety of situations, none of which apply to what I'm trying to do). :-(

Can anyone tell me how to derive from a BasePage that has view in it already? (I saw a tip about making it not visible until the page has been constructed, then make it visible, but that didn't help). Or point me to an example somewhere which implements such a thing?

Note: my UI is in C#, not XAML. Also this is in UWP, if that's relevant.

thanks,
Donald.

I want to Have several values in clickable button

$
0
0

Hi I have a scroll view of buttons with one value, i want to make this button bigger and place inside 2 labels(bindable), texts some circles like at the
img

For this moment my scrollView looks like this so it contains only one value which is text inside button, how can i extend this to my aim

   <BindableLayout.ItemTemplate>
                            <DataTemplate>
                                <Grid WidthRequest="46">
                                    <Label x:Name="date"  Text="{Binding Date}"></Label>
                                    <Button WidthRequest="30" x:Name="dateButton"
                            TextColor="White"
                            BackgroundColor="#0249D7"
                            Text="{Binding DateOfMonth}"
                            Command="{Binding BindingContext.GetMeetingFromDayCommand, Source={x:Reference Name=calendarPage}}"
                                        CommandParameter="{Binding Source={x:Reference date}, Path=Text}">
                                    </Button>
                                </Grid>
                            </DataTemplate>
                        </BindableLayout.ItemTemplate>

@AnubhavRanjan

What is the difference between normal Listview and Syncfusion Listview?

$
0
0

I am trying to establish the same code design that I have in my Normal ListView and pass it to the Syncfusion ListView

This my Listview Design normal

This my listview design with sycnfusion.

Could someone advise me on the design with syncfusion?

SfListView does not select after scrolling

$
0
0

Hi Everyone,

I am having a simple SfListView. When I scroll to the end and try to select an item, selection does not happen.

Replication procedure:
1. Run the attached sample
2. Go to ListView page
3. Scroll to the end
4. Tap on any item in the view (Item does not select)

Note: The issue occurs when selecting an item immediately after scrolling. If I select the item after some delay, the item gets selected.

I really have no idea why this issue occurs with SfListView. If you have any knowledge regarding this issue kindly help!
Please find the attached sample for reference.

Thanks in advance.

While clicking xaml ,some encoding popu is displayed .Why this happens?

$
0
0

While clicking my forms xaml this pops out .. Why this happens.How can i resolve this.
Now i cant view my xaml code.

Shell Top Bar Swipe

$
0
0

Hello,

I created a page via a Shell to switch between tabs. That goes well, only I want to swipe a finger to the left and right to switch tabs. How can I solve this?

This is the WPF code in my mainpage to create the tabs:

<Tab Title="Centrale aansturing" Icon="Switches"> <ShellContent Title="Verlichting / Deuren" ContentTemplate="{DataTemplate local:GBSPage}"/> <ShellContent Title="Verlichtingspunten" ContentTemplate="{DataTemplate local:BuildingLightsPage}"/> <ShellContent Title="Beveiligingscamera's" ContentTemplate="{DataTemplate local:SecurityCamPage}"/> </Tab>


Shell.Current.GoToAsync does not initialize on second call

$
0
0

Hello, I have a Shell application that displays a page using Shell.Current.GoToAsync("//page1). The page appear correctly and after the user hits the OK button I call Shell.Current.GoToAsync("//page2) to display another page. However, if I then call Shell.Current.GoToAsync("//page1") again for the page doesn't fire the Initialize event and the data that was in the controls is still there.

webview does not play video sound on iphone...

$
0
0

in xamarin.forms webview i have loaded an embeded youtube video the video is streaming but the only problem i have is that the audio is not working it shows visual video but no audio.....and it's only problem in ios device in android it's works well...
i have implemented this code..
webView.Source = "http://some embeded youtube url here";
only one line...

SendBroadcast for refreshing gallery

$
0
0

I am developing a Xamarin app which retrives info from DB, take/choose photo and upload them to remote server, display this images from the remote server and the user can delete them by tap on and press a button and download the images from the remote server to the local device.

Everything works without problem, but when I download the image and after I go to the gallery for check it, the image does not appear, whereas I can see it and open in the file explorer. When I reboot the phone, the image appear in the gallery.

I found this way to achieve the result:

private void GalleryRefresh(string file_name)
        {
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
            {
                Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
                Java.IO.File f = new Java.IO.File("file://" + Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads));
                Android.Net.Uri contentUri = Android.Net.Uri.FromFile(f);             
                mediaScanIntent.SetData(contentUri);
                this.SendBroadcast(mediaScanIntent);
            }
            else
            {
                SendBroadcast(new Intent(Intent.ActionMediaScannerScanFile, Android.Net.Uri.Parse("file://" + Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + Android.OS.Environment.DirectoryDownloads + file_name)));
            }
        }

But I am struggling with SendBroadcast, I do not underestand if I have to implement or initialize it somewhere in my solution.

So If anyone hase an idea because my head is gone :D

List child element is not able to find by using the Appium tool

$
0
0

Hi Folks,

I have worked in the Appium testing tool (Version: 1.15.1), I am testing to Xamarin hybrid app (iOS and Android). I can select the view and also get xpath. But, In the list view, I am not able to select the child elements in the list view and also couldn’t find the xpath for child elements.

We have given automation id in source code. Even Appium inspector is not able to get elements. We used Xamarin.Form 4.3, 4.2, 3.5, and 3.0 versions.

        <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell AutomationId="MyViewCell" AutomationProperties.IsInAccessibleTree="True" >
                            <StackLayout Padding="10" AutomationProperties.IsInAccessibleTree="True" >
                                <Label x:Name="titleLbl" AutomationId="TitleLabel" Text="{Binding Text}" d:Text="{Binding .}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="16" AutomationProperties.IsInAccessibleTree="True" />
                                <Label x:Name="desc" AutomationId="DescLabel" Text="{Binding Description}" d:Text="Item descripton" LineBreakMode="NoWrap" Style="{DynamicResource ListItemDetailTextStyle}" FontSize="13" AutomationProperties.IsInAccessibleTree="True" />
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>

Kindly give solutions for this problem.

Thanks.

App not Launch.

$
0
0

when i build my xamarin form application it work fine in physical device (IOS). The problem is that after two days when i have launch my application by press icon the app not work. how to fix?

Viewing all 77050 articles
Browse latest View live


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