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

AppCompat does not resize screen with keyboard.

$
0
0

Given a simple ContentPage with an Editor at the bottom and a list as the first item (Stack with list and Editor), I cannot get the page to be the correct size.

I can put the stack into a scrollview or not, with the Android option AdjustResize set or not, and anyway I do it, the screen pushes the Toolbar or Tabs off the top, unable to be seen.

This does not happen when using FormsApplicationActivity, just the FormsAppCompatActivity.

Any ideas on how to get a user interface that is similar to how traditional chat applications look? Sample project included.


Button background color resetting after change IsEnable to True (windows 8.1 / WindowsPhone)

$
0
0

I create some buttons in the CS code behind of my xaml in a loop. Since those buttons work together I have create a Dynamic Resource for enable and disable them

Resources = new ResourceDictionary
            {
                {"frequencyButtonsEnabled", true }
            };

and after my loop I create the binding

frequencyResponseButton.SetDynamicResource(IsEnabledProperty, "frequencyButtonsEnabled");

It works in the manner that when I do Resources["frequencyButtonsEnabled"] = true; all the buttons are enabled, but the problem is that their background color gets reset, so instead of the Color.Aqua value that I use, their color is the default one.

I tried to add a resource with the color

Resources = new ResourceDictionary
            {
                {"frequencyButtonsEnabled", true },
                {"backgroundButtonsColor", Color.Aqua }
            };

binding it
frequencyResponseButton.SetDynamicResource(IsEnabledProperty, "frequencyButtonsEnabled");
frequencyResponseButton.SetDynamicResource(BackgroundColorProperty, "backgroundButtonsColor");

and recall it after enable my buttons,

Resources["frequencyButtonsEnabled"] = true;
    Resources["backgroundButtonsColor"] = Color.Aqua;

But it is still the default color. Does anybody knows why this happens and/or how to fix it?

Thanks

Edit to add some images and clarify that it works ok on Android

This is the button without setting the IsEnabled to false:

This is how it looks when is disabled:

And this how it looks after get enabled by an event:

Xamarin Forms 4.2.2 ParseXmlns Error

$
0
0

After Updating My Xamarin Forms 4.2.2 my projects is no more compiling and keep getting error.
App.xaml : error : Method not found: 'Void Xamarin.Forms.Xaml.XmlnsHelper.ParseXmlns(System.String, System.String ByRef, System.String ByRef, System.String ByRef)'

I tried all ways clean , rebuild , delete obj bin folders etc. Please some help me and its already 4 hrs i spent on this.

Why is RowDefinitions not working on WindowsPhone but works on WindowsPhone emulator?

$
0
0

Why is RowDefinitions not working on WindowsPhone but works on WindowsPhone emulator? It also works on any android or IOS

the xaml looks something like this:

<Grid
                RowSpacing="0"
                ColumnSpacing="0">
                <Grid.RowDefinitions>
                  <RowDefinition Height="20" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="20" />
                  <RowDefinition Height="*" />
                  <RowDefinition Height="20" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="20" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="20" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="20" />
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="20" />
                </Grid.ColumnDefinitions>

Its on the content page and the error is:
Message = "Object of type 'Xamarin.Forms.RowDefinition' cannot be converted to type 'Xamarin.Forms.View'."

ListView viewCell entry keyboard - binding bug with Android 7 (API 24)

$
0
0

See the example xaml below. This worked fine on API 23, but this morning my phone offered an Android 7 upgrade and I installed it. Now the binding / keyboard is buggy.

Basically, after editing the ItemName, when I enter data into the ExpectedQty or ActualQty entries the ItemName entry receives all the data being entered from the other entry controls. And i've noticed that the Numeric keyboard flashes up then is replaced by the text/default keyboard. Its as though the keyboard linked to the ItemName is being displayed, and hence the data is being fed to the itemname.

I've tried a few things like re-ordering the columns, using different keyboards, and it seems that the first column/keyboard always gets precedence and a similar problem occurs. I've uninstalled the app before redeploying..... cleaned the solution, deleted obj/bin..... before rebuilding.

I've proved this is definitely new to API 24. I created an emulator with API 24 and the same problem occurred. I installed the app on a Android 6.0.1 device and the problem doesn't occur, which makes sense because I haven't touched the related code for a while.

I tried upgrading to the latest version of Xamarin forms (2.3.1.114) and it didn't help.


<ListView.ItemTemplate>



              <Entry Placeholder=""
                            Text="{Binding ExpectedQty,Converter={StaticResource DecimalConverter}}"
                            Keyboard="Numeric"
                            WidthRequest="60"/>
              <Entry Placeholder=""
                            Text="{Binding ActualQty,Converter={StaticResource DecimalConverter}}"
                            Keyboard="Numeric"
                            WidthRequest="90"/>

Can't remove the gap between ScrollView and Grid

$
0
0

There is a big white gap between ScrollView and Grid

Failed to remove the gap by use Padding="0" Margin="0", how to remove it?

The xaml code is

<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Padding="0" Margin="0">
  <ScrollView  HorizontalOptions="FillAndExpand" VerticalOptions="Start" Padding="0" Margin="0">
    <StackLayout>
      <BoxView BackgroundColor="Red" HeightRequest="1000" WidthRequest="150" />
    </StackLayout>
  </ScrollView>
  <Grid HorizontalOptions="FillAndExpand" VerticalOptions="End" ColumnSpacing="0" Padding="0" Margin="0" BackgroundColor="Green">
    <Grid.RowDefinitions>
      <RowDefinition Height="50" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*" />

    </Grid.ColumnDefinitions>

    <Button Text="Item1" Grid.Row="0" Grid.Column="0" Style="{StaticResource bottomButtonStyle}" />

  </Grid>

</StackLayout>

my master page overlap to upper status bar.

$
0
0

my master page overlap to upper status bar. how to overcome top space in master datail page

Toolbar title set center align.

$
0
0

how can i title will be set center align in toolbar using Android layout.


Android keyboard and the ContentPage view collapsing/expanding issue w/ Material Design

$
0
0

Hi, after I upgraded to 1.5.1 and getting material design in place, my app is working and looking great in Android. HOWEVER the view when focussing or unfoccusing the keyboard does not work as expected.

I have a Grid with icons at the bottom of my ContentPage. So when the keyboard expands the Grid should be sitting on top of the keyboard and the Editor shrinking in height to accomodate. As mentioned this worked before the Material Design update.

I am using the IosKeyboardFixPageRenderer from http://stackoverflow.com/questions/31172518/how-do-i-keep-the-keyboard-from-covering-my-ui-instead-of-resizing-it/31172519 for iOS and it works great.

How do I fix this on Android with Material Design?

Thank you

I'm trying to figure out if Xamarin is right for our project

$
0
0

I work for a company that has an old, large Silverlight project that needs to be converted into something else, as Silverlight is quickly losing browser support. The app in question is used both internally and by client organisations for entering a wide variety of personal data and reporting. Everyone internal to the company uses Windows 10, but we have no such guarantees about our client companies who might be on Windows 7, or even on Mac. I had been researching WPF and UWP when someone raised the possibility of using Xamarin.

I need to know, what exactly is Xamarin capable of? Is it primarily for mobile apps? We are pretty much exclusively concerned about making this application work on desktops (or browser if possible) with a single code base.

Using FAB.forms ?

$
0
0

I am trying to add a Flating Action Button to a simple listview using FAB.forms but nothing is appearing & there are no build errors.

I have added FAB.forms v2.1.1 to a XAmarin Forms PCL project and also added Xamarin.Android.Support.Design to Android Packages.

Following the provided guides I have constructed my XAML page as follows

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:FABTest"
             xmlns:fab="clr-namespace:FAB.Forms;assembly=FAB.Forms"
             x:Class="FABTest.Contacts" >
  <ContentPage.Content>
        <RelativeLayout>
            <ContentView
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1, Constant=10}"
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1, Constant=10}">
    <ListView x:Name="EndpointListView" ItemsSource="{Binding Items}" IsVisible="{Binding IsListVisible}" HasUnevenRows="True" SeparatorColor="{DynamicResource ListViewSeparatorColor}" >
      <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <Label Text="{Binding Name}" />
            </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>
  </ContentView>
            <fab:FloatingActionButton
                x:Name="fabBtn"
                Source="plus.png"
                Size="Normal"
                Clicked="Handle_FabClicked"
                NormalColor="Green"
                RippleColor="Red"
                RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=-50}"
                RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=-50}" />
        </RelativeLayout>
    </ContentPage.Content>
</ContentPage>

Are there other additional packages I should be using to get this working?

Can I change back button icon to something else?

$
0
0

Hey guys, so like the title says, is it possible to change the Navigation bar back button icon to something else. I wanted to change the back button in certain pages, replacing it with a home image icon. Tried several methods, none of which worked. I want to do this in Android and IOS

Thanks in advance!

Getting security warning in facebook login ios xamarin.forms

$
0
0

I am working with xamarin.forms app.To login in facebook I am using Xamarin.Auth.It's working fine with Android but as I login in iOS,after successful login, it gives security warning :

SECURITY WARNING: Please treat the URL above as you would your password and do not share it with anynone.See the Facebook Help Center for more information.

It is working fine with Android.Having problem with iOS only. I have searched it on google and got so many solutions but not found the working solution for me.

Converting Relative Layout from Xaml to Code

$
0
0

I am making a simple account page and need to convert the program from .xaml to .xaml.cs
An example of my code is here: How would I convert this to code? Thanks!

"

Image Rotation

$
0
0

Hi everyone, sorry for this silly question but i can't figure it out how to do it well.
I got an image and a button, so i need that every time i press the button the image rotate itself 45 degrees, but for now i only get that it rotate only once.
Here is my sample code:

public class RotationTest : ContentPage
{
    Image image;
    Button rotateButton;
    public RotateImage()
    {
        Title = "Test Rotation";

        image = new Image { Source = ImageSource.FromFile ("testImage.png"), VerticalOptions = LayoutOptions.CenterAndExpand };
        rotateButton = new Button { Text = "Rotate 45°", VerticalOptions = LayoutOptions.Center };

        rotateButton.Clicked += OnRotateButtonClicked;

        Content = new StackLayout
        {
            Margin = new Thickness (0, 20, 0, 0),
            Children =
            {
                        rotateButton,
                        image
            }
        };
    }

    async void OnRotateButtonClicked (object sender, EventArgs e)
    {
        var rt = 45;
            var initialRotation = 0;
            var endRotation = initialRotation + rt; //this is what i try till now
        await image.RotateTo (rt, 2000);
        image.Rotation = endRotation;
    }
}

Custom renderer for Master-Detail - add an icon on top right corner

$
0
0

I'm trying to modify the default appearance of master-detail Xamarin Forms page and add a small icon on the top right corner of the title.
Can someone post examples of custom renderers that add visual elements to the page (for both iOS and Android)?
Most of the examples I've seen only modify existing elements that are already defined in the page, rather than adding new.

Thank you!

Can I have an image change color when tapped?

$
0
0

I'm wanting to have a control that is similar to a switch, but instead is a custom image that changes color when toggled on and off. Is this possible?

Client flow for authorizations against Azure App Service

$
0
0

Hi all,

right now I have a working forms project in IOS and Android using Azure APP service with authentication based on the so called service flow, the one where the login is presented in a web view by the mobile service SDK. I need to change this to use the so called client flow. can any one point me at a working example of this in side forms on both IOS and android. I need to support live and google accounts.

NavigationPage render a title and position hamburger menu

$
0
0

I am trying to create something close to this (ignore the orange lines). The red boxes illustrate the areas I am highlighting for this question.

I need the title MY DRIVES to appear and the hamburger menu to be on the right.

Here is what I have so far. Notice there is no title and the hamburger menu is on the left.

Here is the code I have so far...

        var navPage = new NavigationPage();

        navPage.PushAsync(new MainPage());

        navPage.BarBackgroundColor = Color.FromHex("#174873");
        navPage.BarTextColor = Color.White;
        navPage.Title = "MY DRIVES";

        App.Current.MainPage = new MasterDetailPage
        {
            Master = new MenuPage()
            {
                Title = "Master Page Title"
            },
            Detail = navPage
        };

How can I accomplish the UI in the first picture?

Custom TextOn, TextOff for Switch - possible to override or support on roadmap?

$
0
0

Doing prototyping using Forms 1.3.0.0 (going decent sofar, might turn it into something real) and came upon the Switch component.

In Android this component this has a On/Off text rendered over the switch. In WP and iOS there is no text.

I in the documentation that using the component directly in Android-solution one can set textOn/textOff: http://developer.xamarin.com/guides/android/user_interface/intro_to_switches/

Is there any way to do this using the components supplied for Forms or is there a plan to support this on the roadmap?

My need is a basic True/False usage and would be alright with having no text at all - but a On/Off becomes completely contextually wrong.

Viewing all 91519 articles
Browse latest View live


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