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

How can i do to my layout take all area of my device

$
0
0

I have this issue:

1) When my app run, on bottom of my device there is white space. How can i do to take entire area.

2) When i rotate the layout fail, the image inside grid accup two boxview and the cells(row/column) decrease.

How can i solve this?


Does anyone use SignalR in Xamarin .net Standard 1.4 with Autofac

$
0
0

Does anyone use SignalR in Xamarin .net Standard 1.4 with Autofac ?

I try to follow https://github.com/IncredibleWeb/Xamarin-Forms-Chat-Client , but then I saw that there is some issues with autofac, so I found http://autofaccn.readthedocs.io/…/…/integration/signalr.html , but this pacage does not support .net Standard 1.4.
Error: Package Autofac.SignalR 3.0.2 is not compatible with netstandard1.4 (.NETStandard,Version=v1.4). Package Autofac.SignalR 3.0.2 supports: net40 (.NETFramework,Version=v4.0)

I tried to new up a new instans of my signalR class without using Autofac, but then i get "System.ExecutionEngineException: Attempting to JIT compile method"

I also tried to add the the Autofac.SignalR directly in my . net forms project, but then I need Owin, that gives me Package Owin 1.0.0 is not compatible with netstandard1.4 (.NETStandard,Version=v1.4). Package Owin 1.0.0 supports: net40 (.NETFramework,Version=v4.0)

Is there anyway to get around this ?

ghdrtjdgj

ghdrtjdgj

ghdrtjdgj

Xamarin Forms Android Activities?

$
0
0

Hi,

I have a question please..

In Xamarin Forms, I am creating files in the main project and not acitivities..

Does this mean I only have one activity which is Main?

So if I use analytics system, e.g. Firebase, will I see one Activity (Main)?

Thanks,
Jassim

I don't know what error exactly

$
0
0

I wrote some code relating with login, and connecting local DB(nuget: sqlite-net-pcl). If I clicked login button then, just this message is sent on visual studio.
No compatible code running The selected debug engine does not support any code executing on the current thread (e.g. only native runtime code is executing).
What's the problem? According to some searching, it may be caused by changing models. Then how can I solve this? If I should attach some code or etc. then I will. Thank you.

Picket with enum binding doesn't show initial zero index selection

$
0
0

Hello together,
I just tried to bind an enum to a picker and initially select the first item. The unfortunate result is an empty picker. Selecting the second item works fine (Item[1]). Why is that? Has anyone a solution?

XAML:

ViewModel:
public ObservableCollection Item{
get => _item;
set => SetProperty(ref _item, value);
}
public MyEnum SelectedItem {
get => _selectedItem;
set => SetProperty(ref _selectedItem, value);
}

public void OnNavigatedTo(NavigationParameters parameters) {
Item = new ObservableCollection();
Item.Add(MyEnum.Opened);
Item.Add(MyEnum.Closed);

SelectedItem = Item.First(); // Item[1];

}


Page is not scrolling when keyboard comes in android.

$
0
0

In xamarin forms I build a content page which has login and password entry with a login button. When user click on login entry keyboard comes and focus goes to entry field. Down the login entry password entry is visible but login button is hide behind keyboard. Now user is not able to scroll the view to get keyboard. So when keyboard comes page is not scrolling. I used stack layout inside scrollview. The issue is coming only in android.

Switch inside listview get listview item on toggle

$
0
0

I currently have a listview which displays a list of "ConfigurationItem" objects. Each row displays a "ConfigurationItem"'s Name and Status properties in a label and has a Switch hooked up to It's Checked property value.

When I toggle a switch for a listview item I want to get the "ConfigurationItem" for that corresponds with that switch and the value of the switch so I can change the Checked property value for the "ConfigurationItem". Currenlty I've added an eventhandler for the Toggled event which receives the switch as sender but I can't figure out how I can get the "ConfigurationItem" object that corresponds with the toggled switch. Can someone please explain how I can achieve this?

XAML
<ListView x:Name="ConfigurationItemListView" BackgroundColor="Transparent"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Orientation="Horizontal"> <StackLayout Orientation="Vertical"> <Label Text="{Binding Name}" TextColor="#fff" HorizontalOptions="FillAndExpand" FontAttributes="Bold"/> <Label Text="{Binding Status}" HorizontalOptions="FillAndExpand" TextColor="#fff" FontSize="Micro"/> </StackLayout> <Switch IsToggled="{Binding Checked}" HorizontalOptions="EndAndExpand" Toggled="OnItemToggled"/> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

C#
private Room currentRoom { get; set; } public ConfigurationItemPage() { InitializeComponent(); }

//Room selected public ConfigurationItemPage(Room room) { InitializeComponent(); currentRoom = room; this.Title = currentRoom.Name; GetConfigurationItems(); MessagingCenter.Subscribe<ConfigurationItemDetailsPage>(this, "GetConfigurationItems", (sender) => GetConfigurationItems()); ConfigurationItemListView.ItemSelected += OnItemSelected; }

async void OnItemSelected(object sender, SelectedItemChangedEventArgs e) { if (ConfigurationItemListView.SelectedItem != null) { await Navigation.PushModalAsync(new ConfigurationItemDetailsPage((ConfigurationItem)e.SelectedItem)); } ((ListView)sender).SelectedItem = null; }

public void OnItemToggled(object sender, ToggledEventArgs e) { //Get ConfigurationItem (listview item) //save switch value Switch toggledSwitch = (Switch)sender; }

public async void GetConfigurationItems() { LoadingActivityIndicator.IsRunning = true; LoadingActivityIndicator.IsVisible = true; ConfigurationItemService configurationItemService = new ConfigurationItemService(); IEnumerable<ConfigurationItem> configurationItems = await configurationItemService.GetByRoomId(currentRoom.Id); ConfigurationItemListView.ItemsSource = configurationItems; LoadingActivityIndicator.IsRunning = false; LoadingActivityIndicator.IsVisible = false; }

How to change background from gray on selected item in listview, iOS.

$
0
0

Hi

I am unable to change the background color on the selected item in a listview from gray on iOS.

I have tried to impalement a custom renderer:

using App.Views.View.List;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly: ExportRenderer(typeof(NoSelectionViewCell), typeof(App.iOS.Views.List.NoSelectionViewCellRenderer))]
namespace App.iOS.Views.List
{
    public class NoSelectionViewCellRenderer: ViewCellRenderer
    {
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            UITableViewCell cell = base.GetCell(item, reusableCell, tv);
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            if (cell != null)
            {
                cell.SelectedBackgroundView = new UIView
                {
                    BackgroundColor = UIColor.Red, // This doesn't matter ...
                };
            }

            UpdateBackground(cell, item); // This doesn't seem to do anything ...

            return cell;
        }
    }
}

I want the background to be transparent.

Xamarin Android splash taking too much of time.

$
0
0

Hi,

In my xamarin forms project, my android splash screen taking too much time when opening the project.
Here is the code of splashscreen:

    using Android.App;
    using Android.OS;

    namespace Myproject.Droid
    {
        [Activity(Label = "smartWCM", Icon = "@drawable/icon", Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true, ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait)]
        public class SplashActivity : Activity
        {
            protected override void OnCreate(Bundle savedInstanceState)
            {
                base.OnCreate(savedInstanceState);
                //System.Threading.Thread.Sleep(5000); //Let's wait a while...
                this.StartActivity(typeof(MainActivity));
            }
        }
    }

I try to comment the splash time but taking 15 seconds to show the login page. I need to show the login page within 5seconds.

Any solutions?
Thanks in advance :)

No feedback when tap a button inside a scrollview. Only "click" gives feedback(iOS)

$
0
0

The problem is the lack of feedback on "tap" when button is in a scroll view. You have to push about ½ second before feedback is given.
Appears only in iOS

XAML for easily testing the issue

<StackLayout>
        <Button Text="OUTSIDE SCROLL"></Button>
        <ScrollView>
            <Button Text="IN SCROLL"></Button>
        </ScrollView>
</StackLayout>

Is there anyone who has experienced the same thing and have a solution? Has tested several versions of Xamarin.Forms, same issue

Regards
Mattias

How can i set xamarin uwp app icon

$
0
0

Hi,
I am trying to set xamarin uwp app icon. Set all the icons in Package.appxmanifest --> Visual assets --> App icon. Here is the screenshot:

But no changes in the default xamarin icon!!! Any solutions?
Thanks in advance :)

How can i use hexadecimal color in boxview and c#

$
0
0

I have this code:

public void ChangeColorBoxView(BoxView boxView, Label label, decimal realizado, decimal previsto)
        {
            decimal valor = (realizado / previsto) * 100;

            decimal v = Convert.ToDecimal(string.Format("{0:N}", valor));

            if (v < 99 && v > 75)
            {
                boxView.BackgroundColor = Color.Yellow;
                label.TextColor = Color.Black;
            }
            else if (v < 75)
                boxView.BackgroundColor = Color.Red;
            else
                boxView.BackgroundColor = Color.Green;
        }

but i need to use this way for example. In BackgroundColor i have no Color.FromHex("#FF45A).... How can i do to use color in hexadecimal?


Why I am getting (xamarin page must not already have a parent)

$
0
0

Hi,

I am trying to open a modal page in app using:

await Navigation.PushModalAsync(new NavigationPage(new NewPost()));

but getting:

**xamarin page must not already have a parent
**

Kindly help..

Thanks,
Jassim

XF 2.5.0.122203, strange issues

$
0
0

Hi,
Upgraded our project to XF 2.5.0.122203 but specially for Android it has started showing many strange issues. These issues were not reported by QA in earlier releases now all of a sudden there are new issues. These are mostly related to UI, Forms not drawing even after content is set, Image buttons not showing up.

Our App code has not been changed much in this area so wondering if the origin of these issues lies in XF 2.5.0.122203 upgrade. Also we are building Android APK on Mac, not sure whether this is causing it but in some tests done Mac & Windows build seem to generate same output.

Any guide for this would be highly appreciated.

-Thanks
Mahesh

URGENT: Will someone filter those non-English posts from the English forums...

$
0
0

Isn't this forum filtered to show English only posts? It appears the forum is infected or sort considering so numerous non-English post at once.

Will someone from Xamarin take care of it???

Export option not works for Google Pixel device.

$
0
0

We have developed an Xamarin forms application. We provide option to export file to other apps to explore it. Exported mobi format file to Kindle in Google pixel device, it couldn't upload in Kindle but this process works in other Android devices. We have used PackageManager.QueryIntentActivities process to list the installed app for export process. Please provide valiable suggestion for this.

Regards,
Cheran

Binding does not seem to Work !

$
0
0

Hello,

i added a progress bar inside a column in Xamarin.Forms.DataGrid plugin as follows :
<br /> <dg:DataGridColumn Title="Ratio" PropertyName="ration" Width="1*" ><br /> &lt;dg:DataGridColumn.CellTemplate><br /> <DataTemplate><br /> <StackLayout Padding="4" Orientation="Horizontal"><br /> <ProgressBar x:Name="progress" Progress="{Binding .}" VerticalOptions="CenterAndExpand" /><br /> </StackLayout><br /> </DataTemplate><br /> &lt;/dg:DataGridColumn.CellTemplate><br /> </dg:DataGridColumn><br />

Knowing that other Bindings of this type work perfectly like this one :
<dg:DataGridColumn Title="Matiere" PropertyName="module_nom" Width="2*" ><br /> &lt;dg:DataGridColumn.CellTemplate><br /> <DataTemplate><br /> <StackLayout VerticalOptions="CenterAndExpand" Padding="10,0,10,0"><br /> <Label Text="{Binding .}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="#444444"/><br /> </StackLayout><br /> </DataTemplate><br /> &lt;/dg:DataGridColumn.CellTemplate><br /> </dg:DataGridColumn>

but the binding doesn't seem to work, i get this error : "Object reference not set to an instance of an object.".
I tried to bind with string, double, but no success, i replaced the point in Progress="{Binding .}" with Progress="{Binding ration}" but i get the progressBar empty, any thoughts on this ?

Viewing all 58056 articles
Browse latest View live


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