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

Button that looks like a Label?

$
0
0

Hello community. For my specific project I need to utilize the cross platform button functionality, however I need it to look as though it is a label. I basically have flowing sentences where some of the words are bold. The bold words are being generated as buttons so I can make use of the click events. However it throws off the entire sentence as buttons have huge padding around them that I want to get rid of (see attached screenshot). I tried the following properties to no avail:

var button = new Button();
button.Text = word;
button.FontSize = FontSize;
button.AutomationId = ButtonIDBuffer[0];
button.Margin = new Thickness(0);
button.BorderWidth = 0;
button.BorderRadius = 0;
//button.BackgroundColor = Color.Transparent;
button.BorderColor = Color.Transparent;
button.ContentLayout = new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Top | Button.ButtonContentLayout.ImagePosition.Left, 0);
button.HorizontalOptions = new LayoutOptions(LayoutAlignment.Start, true);
button.VerticalOptions = new LayoutOptions(LayoutAlignment.Start, true);

How can this be achieved?

image

Thanks,
-jv


(Android) OnAppearing not raised when the page is child of a TabbedPage

$
0
0

I have a TabbedPage with two children pages: PageA and PageB, and PageA is the current page.

If I push another page and then I navigate back (pop), the OnAppearing() method of the PageA is not called in Android, but it is in iOS.

Any idea? How can I force it?

Thanks.

Forms Xaml Page in SAP

$
0
0

In a Xamarin.Forms Shared project, should I be able to add a Forms Xaml Page to the Shared project and have it supported in the UWP app? From my observations...

  1. I create a Blank App (Xamarin.Forms Shared) project.
  2. When I run the UWP app, I get the "Welcome to Xamarin Forms!" message. I can hit a breakpoint in App() constructor.
    Question: How does the UWP app resolve the App.cs in the SAP since there's no reference to it from the UWP app?
  3. In the SAP, I add a Forms Xaml Page and get Page1.xaml and Page1.xaml.cs.
  4. in the App.cs file I set MainPage = new Page1, I'm still ok.
  5. I modify App.cs to not set the Content on Page1. Surprisingly, I still get the "Welcome to Xamarin Forms!" message.
    Question: Where is that coming from???
  6. And now I don't even hit the breakpoint, even though I still get the "Welcome..." message.

Very confusing.

How to add a xaml to Xamarin.Forms in VS2015 update2

$
0
0

After I installed VS2015 update2 . I found I cann't add a xaml file to Portable project. When I right click add new item. Just have three cs file .Where is xaml file?I already installed all of VS2015.

trouble in tabbed page

$
0
0

when navigating from one tabbed page to another tabbed page, it is showing the exception like this -

System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.ListViewAdapter from native handle 0x58a0004d (key_handle 0xa92be130).

How to resolve this??

Can't get a resource dictionary to work

$
0
0

I'm writing a xamarin.forms app using mvvmcross and I would like to use a resource dictionary. The issue I have is that none of the properties I set in xaml are getting set in the code behind.

I have a xaml file called app.xaml:

<?xml version="1.0" encoding="utf-8" ?>
<core:MvxFormsApp
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:viewModels="clr-namespace:MvvmCross.Core.ViewModels;assembly=MvvmCross.Core"
    xmlns:core="clr-namespace:MvvmCross.Forms.Presenter.Core;assembly=MvvmCross.Forms.Presenter.Core"
    AutomationId="123"
    x:Class="Mobile4Projects.App">
  <Application.Resources>
    <ResourceDictionary>
      <Color x:Key="backgroundColor">#00287D</Color>
      <Color x:Key="textColor">White</Color>
      </ResourceDictionary>
  </Application.Resources>
</core:MvxFormsApp>

and the code behind looks like this:

public partial class App : MvxFormsApp
    {
    }

Now when I new up the App class the resourcedictionary property is null (the AutomationId is also null).

I'm not really sure why!

Add 'N' number of entry field on button click using xamarin forms and retrive their values

$
0
0

I am working with Xamarin forms and have the requirement to add entry fields dynamically on button tap, the user can add any number of entry fields on the tap of button

I want to know how do i proceed with this as the main hurdle that i am facing here is to maintain the UI and if more entry fields are added the user should be able to scroll them to see the values he has added in the entry fields.

Another issues here would be to get the values out of those entry fields which are dynamically added, can you please suggest how to proceed with this

Getting DLL error after updating to Xamarin.forms 2.2

$
0
0

Hello,

Hoping someone could shed some light on a DLL error I am getting out of the blue. When I compile for an iOS device I am getting the following:

Error MT2002: Failed to resolve "System.Void System.Data.Services.Client.DataServiceContext::set_Timeout(System.Int32)" reference from "Microsoft.Data.Services.Client, Version=5.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" (MT2002) (ClassNow.iOS)

My app was fine up until today and the only changes I think that could have caused this was an update to Xamarin.forms 2.2 or when I added in the Xamarin Versions Plugin (which I removed to test but still get the error).

I have made sure that the version of Micorsoft.Data.Services.Client I am referencing has been built for portable.

Any help tracking this down would be greatly appreciated. Thanks


How to handle with data not IEntity?

$
0
0

How do you implement class for data received via the api , but at the same time non-IEntity? there is for example a method.

public async Task<IList<NewsSentimentIndexes>> getNewsSentimentIndexes(NewsRequest request)
    {
        var res = await _client.getList<NewsSentimentIndexes>(request);
        return res.Value;
    }

There are news entity and news service, but on it I get some data that do not have ID, so it is not Entity.respectively can no longer implement the IEntity interface for it, and use for NewsApiRepository. How to deal with such data?

Is there an easy way to make a XLabs popup layout modal?

$
0
0

I have a requirement to show an entry form as a modal dialog. The current implementation I have is using the PopupLayout control from XLabs. This control isn't really modal as it only shows a view based on user interaction. Is there a way that I can make view modal such that other user input doesn't fall through to content below the popup?

BUG!? OnAppearing triggers on page thats no longer in navigationStack

$
0
0

This started happening in XF 2.2 (Only tested on Android)

PageA is wrapped in a navigationPage.
I push PageB (Navigation.PushAsync(PageB), and then remove PageA from navigationStack (Navigation.RemovePage(Navigation.NavigationStack[0])).

When I check the NavigationStack after pushing PageB and removing PageA, PageB is the only page in it (this is correct)
Press home button, and then back to app = this triggers the OnAppearing event on PageA.

I know this is not the forum for reporting bugs, but I dont know how reporting bugs is done properly. So this is my lazy attemp on getting some focus on this issue. Any reporting help on this is much appreciated (or tell me what I´m doing wrong).

Tank you!

Icons for Windows Phone and dark/light themes.

$
0
0

I am creating app with Xamarin Forms for Android and Windows Phone. How use icon in Windows Phone for dark and light themes? It is my example code in PCL:

   <CircleImage Source="Add"/>

I can add an icon in Windows Phone, but I changed theme icon becomes invisible. How do I solve this problem?

Analysis of Xamarin.Forms source code

$
0
0

image

You probably already know that the Microsoft Corporation bought the Xamarin Company. Even though Microsoft has started gradually opening the source code of some of its products, the Xamarin.Forms code was a big surprise. I couldn't give it the go-by, and decided to check the code using a static code analyzer.

Analysis tool

The project was checked using the PVS-Studiostatic code analyzer; in the development of which I take an active part. We are constantly working on its improvement, modifying and adding new diagnostic rules. This is why with every new project check we are able to find a larger variety of bugs.

image

Each diagnostic rule has documentation, which includes a description of the error, as well as examples of the incorrect, and correct, code. The trial version of the analyzer can be downloaded here. Also, I suggest having a look at an article that was recently written by my colleague. It gives explanations of the reasons behind the limitations of a demo-version, and what should be done to get the full functionality of the tool. For those who were too lazy to read Ц you can just contact us.

P.S. Besides that, there is a nice error basethat we found in open source projects, and a list of articles (open-source projects check, technical details, etc.) I recommend checking it out.

Suspicious code fragments

Let's start with the "classic" errors detected by V3001 diagnostic rule:

const int RwWait  = 1;
const int RwWrite = 2;
const int RwRead  = 4;
....
public void EnterReadLock()
{
  ....
  if ((Interlocked.Add(ref _rwlock, RwRead) & (RwWait | RwWait)) == 0)
    return;
  ....
}

PVS-Studio warning: V3001 There are identical sub-expressions 'RwWait' to the left and to the right of the '|' operator. SplitOrderedList.cs 458

As we see in the code, an expression value is evaluated using bitwise operations. At the same time, in one of the subexpressions RwWait | RwWait, we have the same constant fields. It does not make sense. Also, the set of constants that are declared earlier have the values equal to the power of two number, consequently, they were meant to be used as flags (this is what we see in the example with bitwise operations). I think it would be more sensible to put them in an enumeration marked with [Flags] attribute; that would give a number of advantages when working with this enumeration (see the documentation for V3059).

Speaking about the current example - we assume, that RwWrite constant was supposed to be here. This is one of the minuses of IntelliSense - despite the fact that this tool is very helpful during the code development, at times it can "suggest" the wrong variable, which can lead to an error.

One more code example with a similar error.

public double Left             { get; set; }
public double Top             { get; set; }
public double Right           { get; set; }
public double Bottom       { get; set; }

internal bool IsDefault
{
  get { return Left == 0 && Top == 0 && Right == 0 && Left == 0; }
}

PVS-Studio warning: V3001 There are identical sub-expressions 'Left == 0' to the left and to the right of the '&&' operator. Thickness.cs 29

The subexpression Left == 0 is used twice in the expression. Apparently, that's a mistake. The code Bottom == 0 should be used instead of the last subexpression, as it is the only property (judging by the logic and the property set) that is not checked in this expression.

The following error is peculiar due to the fact that it can be found in two files with similar names and partially similar code. That's how bugs get multiplied - there was an error in one place, then this code was copied to another location - and presto! - Here is another buggy fragment.

public override SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint)
{
  ....
  int width = widthConstraint;
  if (widthConstraint <= 0)
    width = (int)Context.GetThemeAttributeDp(global::Android.Resource.Attribute.SwitchMinWidth);
  else if (widthConstraint <= 0)
    width = 100;
  ....
}

PVS-Studio warning: V3003 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 28, 30. Xamarin.Forms.Platform.Android SwitchRenderer.cs 28

In this code fragment we see strange logic in the if statement. Some condition (widthConstraint <= 0) gets checked, and if its result is not true, this condition is checked again. Is it a bug? Yep, it is. It's not that easy to say how to fix it. This task goes to the author of the code.

As I have said before, the same error was found in the file with the same name. Here is the message issued by the analyzer: V3003 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 26, 28. Xamarin.Forms.Platform.Android SwitchRenderer.cs 26

Thanks to the mechanism of virtual valueswe managed to improve several diagnostic rules, including the V3022 diagnostic, which detects if the expression always evaluates to true or false. Here are some examples that were detected by this diagnostic:

public TypeReference ResolveWithContext(TypeReference type)
{
  ....
  if (genericParameter.Owner.GenericParameterType ==  GenericParameterType.Type)
    return TypeArguments[genericParameter.Position];
  else
    return genericParameter.Owner.GenericParameterType  == GenericParameterType.Type ? UnresolvedGenericTypeParameter :
                                                                                                         UnresolvedGenericMethodParameter;
  ....
}

PVS-Studio warning: V3022 Expression 'genericParameter.Owner.GenericParameterType == GenericParameterType.Type' is always false. ICSharpCode.Decompiler TypesHierarchyHelpers.cs 441

Even though I have deleted part of a method that is not of great interest to us, the error is still not very noticeable. So I suggest simplifying the code, using shorter variable names:

if (a == enVal)
  return b;
else
  return a == enVal ? c : d;

Now everything has become a little clearer. The root of the problem - the second check a == enVal (genericParameter.Owner.GenericParameterType == GenericParameterType.Type) , that is located in the ternary operator. A ternary operator in the else-branch of the if statement makes no sense - in this case the method will always return d value (UnresolvedGenericMethodParameter).

If it's still not very clear - let me give some explanations. In the case where the program gets to the evaluation of a ternary operator, it's already known that the expression a == enVal is false, thus, it will have the same value in the ternary operator. Outcome: the result of the ternary operator is always the same. Well... that's a bug.

It's hard to see these defects right away, even cutting off the redundant code from the method, the error remains in the other part of the code. We had to make additional simplifications to detect this "pitfall". However, it's not a problem for the analyzer, as it coped quite easily with this task.

Of course, this is not the only case. Here's another one:

TypeReference DoInferTypeForExpression(ILExpression expr,  TypeReference expectedType,  bool forceInferChildren = false)
{
  ....
  if (forceInferChildren) {
    ....
    if (forceInferChildren) {
      InferTypeForExpression(expr.Arguments.Single(), lengthType);
    }
  }
  ....
}

PVS-Studio warning: V3022 Expression 'forceInferChildren' is always true. ICSharpCode.Decompiler TypeAnalysis.cs 632

Again, to make it easier to spot the mistake, let's cut out the unnecessary code. And here it is - the condition forceInferChildren gets checked twice; besides that, this variable isn't used in any way between the if statements. If we take into account that this is a parameter of a method, we can conclude that neither other threads, nor any methods, can change it without direct accessing. Thus, if the first if statement is evaluated as true, the second will always be true as well. Strange logic.

There is a diagnostic similar to the V3022 - V3063. This diagnostic rule determines if a part of the conditional expression is always true or false. Thanks to this, we managed to find several interesting code fragments:

static BindableProperty GetBindableProperty(Type elementType,  string localName,  IXmlLineInfo lineInfo, bool throwOnError = false)
{
  ....
  Exception exception = null;
  if (exception == null && bindableFieldInfo == null)
  {
    exception = new XamlParseException(string.Format("BindableProperty {0} not found on {1}", localName + "Property", elementType.Name), lineInfo);
  }
  ....
}

PVS-Studio warning: V3063 A part of conditional expression is always true: exception == null. Xamarin.Forms.Xaml ApplyPropertiesVisitor.cs 280

We are interested in the subexpression exception == null. It is obvious that it will always be true. Why do we need this check then? It's not clear. By the way, there are no comments that could give a hint that the value can be changed during debugging (like // new Exception();)

These are not the only suspicious fragments found by the diagnostic rules V3022 and V3063. But let's move on and see what else was found in this code.

void WriteSecurityDeclarationArgument(
       CustomAttributeNamedArgument na)
{
  ....
  output.Write("string('{0}')",  NRefactory.CSharp.TextWriterTokenWriter.ConvertString((string)na.Argument.Value).Replace("'", "\'"));
  ....
}

PVS-Studio warning: V3038 The first argument of 'Replace' function is equal to the second argument. ICSharpCode.Decompiler ReflectionDisassembler.cs 349

In this code, we are interested in the Replace method which is called for some string. Apparently, the programmer wanted to replace all the single quote characters with a slash and quotation marks. But the thing is, in the latter case, the slash character gets screened, that's why this method call replaces a single quote with a single quote too. Any doubts? Try Equals("'", "\'"). It may not be really evident, but the analyzer is always alert. We can use the @ symbol before the string literal, to avoid screening. Then the correct Replace method call will be the following:

Replace("'", @""\'") 

There are also methods that always return the same values. For example:

static bool Unprocessed(ICollection<string> extra, Option def,
                        OptionContext c, string argument)
{
  if (def == null)
  {
    ....
    return false;
  }
  ....
  return false;
}

PVS-Studio warning: V3009 It's odd that this method always returns one and the same value of 'false'. Xamarin.Forms.UITest.TestCloud OptionSet.cs 239

Regardless of the arguments, and what is executed in this method, it always returns false. You'd probably agree that it looks slightly weird.

By the way, this code was in another fragment - the method was copied, and put in a different place. The analyzer warning: V3009. It's odd that this method always returns one and the same value of 'false'. Xamarin.Forms.Xaml.Xamlg Options.cs 1020

There were several code fragments with a repeated exception generated, that may potentially have bugs.

static async Task<Stream>
  GetStreamAsync (Uri uri, CancellationToken cancellationToken)
{
  try {
    await Task.Delay (5000, cancellationToken);
  } catch (TaskCanceledException ex) {
    cancelled = true;
    throw ex;
  }

  ....
}

PVS-Studio warning: V3052 The original exception object 'ex' was swallowed. Stack of original exception could be lost. Xamarin.Forms.Core.UnitTests ImageTests.cs 221

It could seem that the logic is simple. In the case of an exception, we perform some actions, and then generate it again. But the devil's in the details. In this case, when the exception is re-thrown, the stack of the original exception gets fully "lost". To avoid this, there is no need to throw the same exception, it would be enough to re-throw the existing one, by calling the throw operator. Then the code of the catch block will be like this:

cancelled = true;
throw;

A similar example:

public void Visit(ValueNode node, INode parentNode)
{
  ....
  try
  {
    ....
  }
  catch (ArgumentException ae)
  {
    if (ae.ParamName != "name")
      throw ae;
    throw new XamlParseException(
      string.Format("An element with the name \"{0}\" already exists in this NameScope",  (string)node.Value), node);
  }
}

PVS-Studio warning: V3052 The original exception object 'ae' was swallowed. Stack of original exception could be lost. Xamarin.Forms.Xaml RegisterXNamesVisitor.cs 38

In both cases the information about the previous exception is lost. We could suppose that in the second case the information won't really be relevant (although it is still strange), in the first case the programmer intended to locate this exception earlier, but instead, a new one was generated. The solution is the same as in the previous example - call the throw operator without arguments.

Speaking about the following fragment - it's hard to say for sure if it is an error or not, but it looks at least strange.

void UpdateTitle()
{
  if (Element?.Detail == null)
    return;

   ((ITitleProvider)this).Title = (Element.Detail as NavigationPage)?.CurrentPage?.Title ?? Element.Title ?? Element?.Title;
}

PVS-Studio warning: V3042 Possible NullReferenceException. The '?.' and '.' operators are used for accessing members of the Element object Xamarin.Forms.Platform.WinRT MasterDetailPageRenderer.cs 288

The analyzer was suspicious about the fact that the accessing the Title property is done in different ways - Element.Title and Element?.Title at that the addressing is first done directly, and then - using a null-conditional operator. But everything is not so simple.

As you may have noticed, in the beginning of the method there is a check, Element?.Detail == null, which supposes that if the Element == null, then the method will exit here, and there will be no other operations.

At the same time, the expression Element?.Title implies that at the time of its execution, the Element can be null. If it is so, then on the previous stage at the time of accessing the Title property directly, we will have the exception of NullReferenceException generated, and therefore there is no use in the null-conditional operator.

In any case, this code looks very strange, and it needs to be fixed.

It was also strange that an object was cast to its own type. Here is an example:

public FormsPivot Control { get; private set; }

Brush ITitleProvider.BarBackgroundBrush
{
  set { (Control as FormsPivot).ToolbarBackground = value; }
}

PVS-Studio warning: V3051 An excessive type cast. The object is already of the 'FormsPivot' type. Xamarin.Forms.Platform.UAP TabbedPageRenderer.cs 73

In this case, it's not a bug, but this code looks at least suspicious, taking into consideration that Control object already has a FormsPivot type. By the way, is not the only warning of this kind, there were many others:

  • V3051 An excessive type cast. The object is already of the 'FormsPivot' type. Xamarin.Forms.Platform.UAP TabbedPageRenderer.cs 78
  • V3051 An excessive type cast. The object is already of the 'FormsPivot' type. Xamarin.Forms.Platform.UAP TabbedPageRenderer.cs 282
  • V3051 An excessive type cast. The object is already of the 'FormsPivot' type. Xamarin.Forms.Platform.WinRT.Phone TabbedPageRenderer.cs 175
  • V3051 An excessive type cast. The object is already of the 'FormsPivot' type. Xamarin.Forms.Platform.WinRT.Phone TabbedPageRenderer.cs 197
  • V3051 An excessive type cast. The object is already of the 'FormsPivot' type. Xamarin.Forms.Platform.WinRT.Phone TabbedPageRenderer.cs 205

There are conditions that could be simplified. An example of one of them:

public override void LayoutSubviews()
{
  ....
  if (_scroller == null || (_scroller != null &&  _scroller.Frame == Bounds))
    return;
  ....
}

PVS-Studio warning: V3031 An excessive check can be simplified. The '||' operator is surrounded by opposite expressions. Xamarin.Forms.Platform.iOS.Classic ContextActionCell.cs 102

This expression can be simplified by removing the subexpression _scroller! = null. It will be evaluated only if the expression to the left of the '||' operator, _scroller == null is false, consequently, _scroller isn't null, so, we can be not afraid to get NullReferenceException. Then the simplified code will be like this:

if (_scroller == null || _scroller.Frame == Bounds))

Conclusion

image

The check of Xamarin.Forms was quite rewarding - we found several interesting fragments; some were really erroneous, some - suspicious and strange. My hope is that the developers will notice the article, and fix the issues that we have discussed here. You can see all the suspicious code fragments by downloading a trial version of the analyzer. The best solution would be to implement PVS-Studio and use it regularly, which will allow the detection of errors during the early stages of development.

Add Toolbar with Two BarButton Item in Forms

$
0
0

Hi ,

How can i add Toolbar below NavigationBar with spacing of 20 in iOS nd Droid using Xamarin Forms, Is it possible means can anyone help me out in this ?

For more info pls find the snap below :

Mysterious gray colored bar in every DetailPage of MasterDetailPage, after applying AppCompat.

$
0
0

I've noticed there a gray bar on top of every detail page of my MasterDetailPage.

No such issue for other content page. This only occurs after I've applied AppCompat. Pre-AppCompat there was no such issue.

I've come across this thread. The proposed workaround is to not to wrap MasterDetailPage in NavigationPage. No explanation was given on the rationale of it. While the workaround works in isolation, it's not feasible for me not to wrap the MasterDetailPage, as the MasterDetailsPage serves as the root of the navigation stack.

Any explanation & workaround is greatly appreciated.


How to send Email in background process

$
0
0

I am working on an app where I need to send email in the background process. I want to implement it in a way where no default mailing application will be initiated by sending an email.

Ex: Send email to admin when new order is placed or new user register

Xaml OnPlatform to specify width for ColumnDefinition

$
0
0

Is it possible to set a column definition depending on the device type (phone or tablet)?

I tried "<OnIdiom x:TypeArguments=" but my code seems to be invalid.

 <Grid
        BackgroundColor="Aqua"
        RowSpacing="0"
        ColumnSpacing="0">

        <Grid.RowDefinitions>
            <RowDefinition Height="80" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <!-- Custom definition per device type -->
            <ColumnDefinitions.ColumnDefinition>
                <OnIdiom x:TypeArguments="Width">
                    <OnIdiom.Phone>"*"</OnIdiom.Phone>
                    <OnIdiom.Tablet>"500"</OnIdiom.Tablet>
                </OnIdiom>
            </ColumnDefinitions.ColumnDefinition>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
</Grid>

AVPlayerViewController not presenting in Xamarin.iOS app.

$
0
0

Hello All.
i am new to Xamarin.i am trying to play sound using AVPlayerViewController in Xamrin.iOS from list view.Here is my button Action.
var playBtn = new Button () {
WidthRequest = 50,
HeightRequest = 50,
BackgroundColor = Color.Transparent,
Command = new Command(() =>{
DependencyService.Get().PlayAudioFile("Audio.mp3");
})
playBtn is custom cell button.Cell data is Populated using XAML
The "PlayAudioFile" is an interface and is Platform specific.i am currently using it for iOS.

Here is my iOS UIViewController Code
public void PlayAudioFile(string fileName)
{
string sFilePath = NSBundle.MainBundle.PathForResource(Path.GetFileNameWithoutExtension(fileName), Path.GetExtension(fileName));
var url = NSUrl.FromString (sFilePath);
var player = new AVPlayer (url);
player.Rate = 0.25f;
var playerVC = new AVPlayerViewController();
playerVC.Player = player;
playerVC.AllowsPictureInPicturePlayback = true;
playerVC.View.Frame = this.View.Frame;
player.Play ();
this.PresentViewController (playerVC, true, null);
}

But the AVPlayerViewController is not playing audio and nor its Presenting in view controller.What am i doing wrong.
Thanks in Advance.

Switch (Checkbox) on Android KitKat measurement/layout issue

$
0
0

Hi,

I'm using a Switch (Checkbox) control with Xamarin Forms (XAML):
<Switch IsToggled="{Binding RememberCredentials}" />

On Android Lollipop and above, everything is fine.
On Android KitKat, the Switch is not shown initially, when turning the device from portrait to landscape it appears.
It also appears if I tap on an Entry control and the keyboard pops up.

There is a SO post describing this (or such an) issue, where explicit Height-/WidthRequest is suggested as workaround.

Is there any other way to overcome this behavior without using absolute heights/widths?

Regards,
Helmut

Issue with using Custom Font with Font Family - Interstate

$
0
0

Hi,
We are using Interstate Bold Custom font in our Xamarin forms. But we are getting an error “throwing exception that “ Font family is not recognized”.

Please help!

Thanks,
Nandini.B.

Viewing all 58056 articles
Browse latest View live


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