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

Making a generic picker page with Xamarin Forms


I cannot use OpenGLView in a Xamarin.Forms project for Android

$
0
0

I tried to use the code found here :
https://developer.xamarin.com/api/type/Xamarin.Forms.OpenGLView/

using Xamarin.Forms;
using OpenTK.Graphics.ES30;

But When Debug starts, a Window opens (image attached) :
"Find Source"
And looks for the following file :
UncaughtExceptionHandler.cs
here :
/Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/UncaughtExceptionHandler.cs

When cancelled, the following error appears :
"Unhandled Exception:
Java.Lang.IllegalArgumentException: No configs match configSpec"

I guess my java or Android sdk or opentk.dll configuration is not ok.

I tried both using OpenTK.Graphics.ES20 and ES30.

Does anybody know a solution ?

Quick and dirty demo for those who start with OpenGlView

$
0
0

I wrote this starter demo based on Xamarin triangle ES20 demo. I hope that will help people to use OpenGlView.

Iam trying to remove spacing between two stacklayouts but it's not working any help

$
0
0

<StackLayout Spacing="0" BackgroundColor="Black"  >
      <Label TextColor="White" Text="test" ></Label>
  </StackLayout>
   <StackLayout BackgroundColor="Blue" Spacing="0">
         <Label TextColor="Black" Text="test1" ></Label>
   </StackLayout>

Stop ScrollView scrolling from child elements (works in Android but not iOS)

$
0
0

Hi - i've seen this discussed a lot with Android, and with plenty of examples it was an easy fix. The ScrollView has a child with a custom renderer, in which i capture Touch events, like a joystick pad.

In Android i use this.Parent.RequestDisallowInterceptTouchEvent(true) successfully, as such...

void progress_Touch(object sender, Android.Views.View.TouchEventArgs e) {

  switch (e.Event.Action) {

    case MotionEventActions.Down:
      this.Parent.RequestDisallowInterceptTouchEvent(true);
      Element.BindableTouchDown((int)e.Event.GetX(), (int)e.Event.GetY());
      break;

    case MotionEventActions.Move:
      Element.BindableTouchMove((int)e.Event.GetX(), (int)e.Event.GetY());
      break;

    case MotionEventActions.Up:
    case MotionEventActions.Cancel:
      Element.BindableTouchUp((int)e.Event.GetX(), (int)e.Event.GetY());
      this.Parent.RequestDisallowInterceptTouchEvent(false);
      break;
  }
}

However, in iOS i tried a bunch of different things without success. Such as...

void setParentTouches(bool enabled) {

  UIView t = this.Superview;
  while (t != null) {

    if (t.GetType() == typeof(ScrollViewRenderer))
      t.UserInteractionEnabled = enabled;

    t = t.Superview;
  }
}

public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) {

  setParentTouches(false);

  var touch = touches.AnyObject as UITouch;

  Element.BindableTouchDown((int)touch.LocationInView(this).X, (int)touch.LocationInView(this).Y);

  base.TouchesBegan(touches, evt);
}

public override void TouchesMoved(Foundation.NSSet touches, UIKit.UIEvent evt) {

  var touch = touches.AnyObject as UITouch;

  Element.BindableTouchMove((int)touch.LocationInView(this).X, (int)touch.LocationInView(this).Y);

  base.TouchesMoved(touches, evt);
}

public override void TouchesEnded(Foundation.NSSet touches, UIKit.UIEvent evt) {

  setParentTouches(true);

  var touch = touches.AnyObject as UITouch;

  Element.BindableTouchUp((int)touch.LocationInView(this).X, (int)touch.LocationInView(this).Y);

  base.TouchesEnded(touches, evt);
}

public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt) {

  setParentTouches(true);

  var touch = touches.AnyObject as UITouch;

  Element.BindableTouchUp((int)touch.LocationInView(this).X, (int)touch.LocationInView(this).Y);

  base.TouchesCancelled(touches, evt);
}

[Xamarin.Forms] Is network connextion ?

$
0
0

Hello,

I want a method to know if the phone is connected to the internet.
I try with NetworkInterface.GetIsNetworkAvailable() but it does not work

Thank you for your help. Loïc

How to center things Vertically in a StackLayout when the orientation is Vertical

$
0
0

Hi, I was wondering how to center things in a StackLayout. I can set the orientation to StackOrientation.Vertical and set the VerticalOptions to LayoutOptions.Center, but the items are only centered horizontally at the top of the screen. How do I have a stack that expands starting in the middle of the device's screen, so that I don't have to hard-code numbers for the padding?

Does Xamarin Forms Support RelativeSource on a Binding?

$
0
0

for example:

{Binding Path=PathToProperty, RelativeSource={RelativeSource AncestorType={x:Type typeOfAncestor}}}


Windows Phone Device ID

$
0
0

Hello guys,
I need to get ID of Android and WP device. I have no problem with Android, but there is one with WP. I try to use this method:

byte[] myDeviceId = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");

but VisualStudio says to me that there is no valid improt for Microsoft class and also I can't find any. Is it removed now?

I want to change the text of the label when user click on a cell in the but binding is not working

$
0
0

<ListView  x:Name="List">
      <ListView.ItemTemplate>
        <DataTemplate>
          <ViewCell>
            <ViewCell.View>
              <Grid>
                <StackLayout>
                  <Label Text="{Binding Quantity}"    />
                </StackLayout>
              </Grid>
            </ViewCell.View>
          </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>

List.ItemTapped+=  (sender, e) =>
            {
                var item = (item)e.SelectedItem;
                item.Quantity +=1;
            };
        }

Push Notification

$
0
0

Hi all.... I need to developer a notification push for test same apps (IOS, Android and WP8.1). It's my first push and I've asks a lot.

Can I dev a push notification without a Service of Azure notification hub?
Someone knows other company have the similar service?

Ps.. the Azure canceled my free account.

tks :)

Set Transparent Background color of Navigation Bar

$
0
0

Hi ,

I tried to set the transparent background color of the navigation bar using below code snippet, But I can't able to proceed this.

For more info please find the snap

MasterDetailPage NavigationService MVVM Light

$
0
0

Hi guys,
someone use mvvm light by Laurent Bugnion? I have a problem with navigationservice..
I have found this code:
https://mallibone.com/post/xamarin.forms-navigation-with-mvvm-light
https://github.com/mallibone/MvvmLightNavigation.XamarinForms
but it doesn't work, the problem is when in App.cs set the MainPage, Runtime return System.Exception: Android only allows one navigation page on screen at a time.
However someone know the best way or a package to implement NavigationService in Xamarin.Forms with MasterDetailPage?

Thank u!!!
DS

How to load DetailPage once

$
0
0

Hi,
i noticed detailpage is loaded from scratch everytime masterpage menu item is selected (so its constructor is called everytime).
Is there a way to implement a detailpage which is loaded once, so everytime menu item is selected detailpage is simply showed/not showed?

Thanks,
Lewix

Xamarin.Forms tomorrow's Date causes "invalid value for Time" error in DateSelected Event Handler

$
0
0

I believe the offer.EndTime line is causing the problem.

offer.StartDate = DateTime.Now.Date;
offer.StartTime = DateTime.Now.TimeOfDay;

offer.EndDate = DateTime.Now.Date;
offer.EndTime = DateTime.Now.TimeOfDay.Add(TimeSpan.FromHours(2));

If I create an offer after 10pm, I get the following error in the OnBindingContentChanged method.

System.ArgumentException: Value was an invalid value for Time
Parameter name: value

Here is the DateSelected methods.

startDatePicker.DateSelected+=((o2,e2)=>
{
    this.startDateSelectedLabel.Text = "true";
    vm.CurrentOffer.StartDateSelected = "true";
});

endDatePicker.DateSelected+=((o2,e2)=>
{
    this.endDateSelectedLabel.Text = "true";
    vm.CurrentOffer.EndDateSelected = "true";
});

Is this a bug or is there a way I can handle this?

Any help is much appreciated. Thanks!


Is it possible to hide suggestions in Android keyboard?

$
0
0

Hi guys.

Would it be possible to hide the suggestions in the Android keyboard?

I do not like it because takes too much space.

Thanks in advance mates :)

SelectedItem in ListView and tap recognizer

$
0
0

We are using Xamarin Forms 2.1.0.6529 to develop an app for iOS, Droid and UWP.

In one page, we have a ListView whose cells are ViewCells. Individual cells can be selected, but multiple selection is also possible. To support multiple selection, each view cell has a selection indicator, a label with a Tap Gesture Recognizer, which shows a check mark if the label is tapped. To confirm multiple selection, a button is used which navigates to another page when clicked. For individual cell selection, we use the SelectedItem property and when selected we navigate to another page.

This works fine on iOS and Droid, i.e. when tapping on the selection indicator label, the SelectedItem property is NOT set.
However, on Windows UWP, both the SelectedItem is set and the tap gesture is fired. Since the SelectedItem is set, we immediately navigate to another page, which is not intended. What is even worse, is that first the SelectedItem property is set and then the tap gesture is fired. This means that we cannot even only navigate if the selection indicator has not been set.

Is this a Xamarin bug, since Windows UWP behaves differently to iOS and Droid?

Any ideas for workaround?

ToolbarItem Command binding doesn't work

$
0
0

.. when defined in xaml:
<ContentPage.ToolbarItems>

FreshMvvm - Master Detail with TabbedPage

$
0
0

Hi, I have a question about FreshMvvm navigation:
How do I put a TabbedPage in Detail of MasterDetailPage using FreshMvvm?
I can't figure out how to do that with AddPage() that takes a FreshMvvmPageModel as a parameter.
I made a PageModel to the TabbedPage but it gives me error when lauching

Thanks in advance

What is wrong with this code!?

$
0
0

I following code is an example from a larger codebase that should have enough context for my issue. In my code I'm calling AppendText many times in a row. I would expect the ScrollingStackCount after all 3 calls to = 0 (after the last ScrollingStackCount--) but sometimes it may be 1 or even 2. I'm assuming it has something to do w/how I'm doing the await but do not understand. Thanks, -jv

private int ScrollingStackCount=0;

void Test()
{
    AppendText("text");
    AppendText("text");
    AppendText("text");
}

async void AppendText( string formattedText )
{
this.Children.Add( new Label() { Text=formattedText } );

    ScrollingStackCount++;
    await parentScroll.ScrollToAsync(this, ScrollToPosition.End, !string.IsNullOrEmpty(formattedText));
    ScrollingStackCount--;
}
Viewing all 58056 articles
Browse latest View live


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