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

Content Page Secondary Toolbar Items in iOS same as Android

$
0
0

I am using secondary toolbar items in my content page. I want the same menu items in iOS as in android. By default it is showing under navigation bar. How can I achieve this.


Xamarin Navigation

$
0
0

I am developing cross-platform apps using xamarin form.

I would like to know how to implement navigation drawer in both iOS and Android.

Regards,
Simto

Google Drive Rest API

$
0
0

Hi, I am trying to implement a feature in my app where the user logs in on their Google account and can upload/download to their Drive.
I have a functioning solution using Android.Gms.Drive, and Android.Gms.Auth.Api.SignIn, but, unsurprisingly this only works for android and with the deprication of Google Drive Android API, this will need to be migrated to the rest api anyway.

The question I have is, are there any good tutorials for implementing this? The one I find aren't intended for Xamarin, along with the fact that I am uncertain which libraries are best for the situation.

Any suggestions are appreciated.
Thank you for your time and assistance.

Position of InitializeComponent

$
0
0

I have question with regards to the position InitializeComponent in the App.xaml.cs ?

If I place InitializeComponent below the MainPage statement, the style.css styles will be be applied in all the pages. Is this a bug or work by design ? If it is a work by design then there should be a big warning in the Docs as I can cause hours or days of head banging to locate the issue.

public App()
{
    InitializeComponent();

    MainPage = new NavigationPage( new MyOwnPage());

}


    <Application.Resources>
               <StyleSheet Source="/Assets/style.css"/>
     </Application.Resources>

Refresh all list view

$
0
0

Hello friends. How do I refresh all the list views in the project at the same time ?

How to prevent pages from navigating Multiple Forms

$
0
0

In Xamarin Forms, I have a list view and on tapping one item in the list view it will be taking us to the next content view. If I am tapping the item in the list view quickly for multiple times we can see the screens are navigated multiple times. How can we avoid it?

Issue while opening Xamarin form from BroadcastReciever class

$
0
0

This is for tracking incoming and outgoing phone calls. I am pushing a Xamarin form in the application Navigation stack from BroadcastReciever class using following code:

var phoneAddPage = new SomePage();
Xamarin.Forms.Application.Current.MainPage = new NavigationPage(phoneAddPage);

The page is getting pushed properly as expected. Issue is the page is overlapped by Splash Screen when application is opened. The form is functioning properly, overlap is the only issue.

How to prevent pages from navigating Multiple Forms

$
0
0

In Xamarin Forms, I have a list view and on tapping one item in the list view it will be taking us to the next content view. If I am tapping the item in the list view quickly for multiple times we can see the screens are navigated multiple times. How can we avoid it?


Loading an Image from a Resource in xaml

$
0
0

I have a resource called biglogo.png added via the Resource menu and now it's in the Resources folder of my project.

I want to use it via xaml but neither

nor

seem to work. Is there a straightforward way to make it work?

How can I access Navigation from within a ViewCell?

$
0
0

Let's say that I have a custom ViewCell for a ListView, where each cell contains a button. When a user clicks that button I'd like to be able to push a new page onto the navigation stack. The problem is that because I'm not inside the ContentPage, but in a ViewCell, I don't have access to the Navigation property.

The cells themselves are also managed automatically through the ListView, so as far as I know I don't have a way to pass the parent ContentPage through the constructor, right?

Is there a way to access the Navigation features from the ViewCell? Or do I need to somehow restructure my ListView to pass the ContentPage through to each ViewCell?

Style.Triggers TargetType="Button" Property="IsEnabled"

$
0
0

Hello,

I wanted to give a new try to Triggers to avoid using converters / VisualState / CustomRenderer.

I got a ListView filled with data which contains several buttons. Those buttons have their IsEnabled property binded and they use a style which use a Trigger to change the TextColor / Opacity / BackgroundColor to show to user that a button is either available or not.

It doesn't seems to work as I expect.

Here is the style :
<Style x:Key="ContextualCellButtonStyle" TargetType="Button">
<Style.Triggers>
<Trigger TargetType="Button" Property="IsEnabled" Value="False">
<Setter Property="Text" Value="IsEnabled=False" />
<Setter Property="TextColor" Value="Green" />
<Setter Property="BackgroundColor" Value="Red" />
</Trigger>
<Trigger TargetType="Button" Property="IsEnabled" Value="True">
<Setter Property="Text" Value="IsEnabled=True" />
<Setter Property="TextColor" Value="Red" />
<Setter Property="BackgroundColor" Value="Green" />
</Trigger>
</Style.Triggers>
</Style>

(The values used are not the final one, it's just to debug)
As you can see, when a button is enabled, the text should be IsEnabled=True with a green background and red foreground.
If the button is not enabled, the text should be IsEnabled=False with a red background and green foreground.

In my design time model, I've set the first item to enabled and the second one to disabled :

And in my XAML, I have this :

Here is the result I got :

You can see that when the IsEnabled=False, it uses the trigger IsEnabled=True and when the IsEnabled is set to true, I don't have the style I want too.

I guess the Triggers work when the IsEnabled property changes at runtime but I'm not sure. If it is the case, what do you recommend ? A custom control ? A custom renderer ?
I would like to avoid VisualState because I'd like to use MVVM without code behind for this stuff.

I have already written some custom renderer like this but I thought Trigger would be better in this case so I won't have to create a custom control and a custom renderer :

Any help or suggestion is welcomed.
Thanks for reading so far !

What is default height of navigation bar ?

$
0
0

Hello,

I was wondering what is the default height of navigation bar ? Something like 15% of the screen ?
I would like to manually reproduce a navigation bar on a modal page, with the same size than the default navigation bar.

Thanks.

Binding to an element of an array (or List)

$
0
0

After much googling, I haven't found an answer to this.

I have an array of colors. I want to bind a Button's BorderColor to a specific element within an array.
What is the syntax to achieve this?

Xaml:

 BorderColor="{Binding ButtonColors[11], Converter={Services:ByteToBorderColourConverter}}"

ViewModel:

private List<byte> buttoncolors;

public List<Byte> ButtonColors
    {
        get => buttoncolors;
        set
        {
            buttoncolors = value;
            OnPropertyChanged();
        }
    }

...

ButtonColors[11] = (Byte)Data[3];

I've also tried implementing this with List, but it also doesn't work.
I think the xaml binding syntax is incorrect maybe?

Adding TextChanged event to an Entry view is crashing whole XAML?

$
0
0

If I remove the event, all is well. Any explanation? Any resolution?

Display original icon of ToolBarItem without changing the color

$
0
0

I have a problem with ToolBarItem icon. The icon image color is changing with respect to the tintcolor. Image contains Text with different colors(PFA).
If i didn't set the TintColor than it is taking the image color as default. But i want to display the original image with different colors for particular page.


How to restrict listview for multi item select at a time?

$
0
0

I have a listview inside my content page,on listview item select it will open the edit page.But user can select multiple list item with his fingers at a time.
So how to restrict listview so that user can only open single item at a time?
How to solve this?

How to change the visiblity of selected image in listview xamarin forms?

$
0
0

Need to change the image visibility to true when clicking the item in the listview.Please help
`

            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>

                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="auto" />
                            </Grid.ColumnDefinitions>
                            <Label
                                Margin="20,0,0,0"
                                Style="{StaticResource BasicFontLabelMedium}"
                                Text="{Binding firstName}"
                                VerticalOptions="Center" />
                        **    <Image
                                HeightRequest="30"
                                HorizontalOptions="End"
                                IsVisible="{Binding Selected}"
                                Source="tick_orange"
                                VerticalOptions="End"
                                WidthRequest="30" />**
                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>`

How best to optimise BackgroundColors in a hierarchy of Views when the Colors will be the same?

$
0
0

A ViewModel has a public property that returns the state of some entity.
The View presents that state information in the form of the BackgroundColor (accessibility is taken care of separately).
The ViewModel doesn't know how the View presents the state, so the View uses a ValueConverter to convert the state to the corresponding Color.
All good so far.

The View is made up of a Layout and the Children of that Layout (and any Children or Content of those Children).
The BackgroundColor of the Layout represents the state of the entity.
The BackgroundColor of the Children (and further descendants) of the Layout will also represent the state of the entity, so will be equal to the BackgroundColor of the Layout.

Various implementation methods exist:
(1) The Layout and each of the Children have their BackgroundColor bound to the ViewModel property, each using the ValueConverter. That means lots of repeated conversions.
(2) The Layout has its BackgroundColor bound to the ViewModel property, and each of the Children have their BackgroundColor set to Color.Transparent. So, only one conversion and a lot of Transparent colors.
(3) The Layout has its BackgroundColor bound to the ViewModel property, and each of the Children have their BackgroundColor bound to the Layout's BackgroundColor
(4) Any others?

So, the question is - without breaking MVVM, which would be expected to be the most performant implementation?

How to Create Custom Notification Layout

$
0
0

Following is the code I am using to create RemoteView :

    RemoteViews expandedView = new RemoteViews(Forms.Context.PackageName,Resource.Layout.notification_custom_remote);
               expandedView.SetTextViewText(Resource.Id.customTextView, "Hey there!!!!!!!!");

And following is the error i am getting:

Any help would be appreciated!!

CarouselView: How to access control inside DataTemplate?

$
0
0

Hi,

I would like to access the control lblName on page 2 for example, is it possible?

   <control:CarouselView.ItemTemplate>

       <DataTemplate>

            <Label x:Name="lblName" Text="{Binding LabelText}" />

       </DataTemplate>

   </control:CarouselView.ItemTemplate>

Thank you and best regards
Chris

Viewing all 91519 articles
Browse latest View live


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