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

Make a stacklayout tappable with prism...on masterdetail page..

$
0
0

Is their a way in prism to make the stacklayout 'clickable/tappable' as a menu item?

<MasterDetailPage.Master>
    <ContentPage Title="Panel">
        <StackLayout  VerticalOptions="FillAndExpand"  Orientation="Vertical">
            <StackLayout ONCLICK="???????" BackgroundColor="#e74c3c"   HeightRequest="75">
                <Label Text="Some Text title" FontSize="20" VerticalOptions="CenterAndExpand" TextColor="White" HorizontalOptions="Center"/>
            </StackLayout>
            <StackLayout   VerticalOptions="FillAndExpand"  Orientation="Horizontal"  Padding="4,4,0,4"  Spacing="4">
                <Image Source="zspotter.png"  WidthRequest="12"   HeightRequest="12"   VerticalOptions="Center" />
                <Label  Text="Dashboard" FontSize="Medium" VerticalOptions="Center"  TextColor="Black"/>
            </StackLayout>
        </StackLayout>
    </ContentPage>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
    <NavigationPage>
        <x:Arguments>
            <local:Clients />
        </x:Arguments>
    </NavigationPage>
</MasterDetailPage.Detail>


DataBinding Error No Property, Bindable Property or Event Found

$
0
0

Hey Guys,

i want to make a Bindable Property but i get this Error:
No Property, Bindable Property or Event Found

in Xaml:
Checked="{Binding NoticeUserData}"

in my class:
public static BindableProperty CheckboxProperty =
BindableProperty.Create(nameof(Checked), typeof(bool), typeof(Checkbox), true);

public bool Checked
{
get
{
return (bool)GetValue(CheckboxProperty);
}
set
{
SetValue(CheckboxProperty, value);
}
}

What do i miss? Can anyone help me i have never done before a databinding Property.

Thanks for help!

Effects in Xamarin.Forms 3

$
0
0

Hi, I'm trying to apply an effect on a Button using the Effects API. On the platform code(Android) I always get a null Control.
I read about a cast problem on TContainer and TControl, but I can't figure out which types to use:

public class DroidShadowEffect : PlatformEffect<ViewGroup, Android.Widget.Button>

How tu use the new Device.RuntimePlatform

$
0
0

Hello, could someone help me to understand how to use the new Device.RuntimePlatform with this kind of call :

statusLayout = new StackLayout
{
Padding = new Thickness(Device.OnPlatform(10,0,0), 0, 0, 0),
Spacing = 0,
BackgroundColor = Color.Black,
HorizontalOptions = LayoutOptions.Start,
VerticalOptions = LayoutOptions.Center,
Orientation = StackOrientation.Vertical
};

I would appreciate to avoid making a really big switch case everywhere I use that.

Thanks!

Phil

stable

How to put fastcell into blank project

$
0
0

i have a noob question, how can i put fastcell into my project, i watch the project on gitbut but i dont know how to put it in my project (blank project), i'm New and it's quite complicated for me, can somebody guide me to handle this problem? Sorry my bad english.
Thank in advance.

How to manage(represent/control) emoji in Xamarin.Form?

$
0
0

Hi,

I want to handle emoji for 3 points.

1- Represent Emoji: I have functionality where user enter in Entry(textbox) and I show it in Label. Currently I use Label control to display text. I want to show Emoji selected by user in Label. If I try to show that emoji in label, it shows ??. Do I need to set any property to represent symbol or I need to change control? If I need to change control, which control I should use.

2- Pass Emoji in API: I want to save user entered text. Currently I only save text to database using API. I want to save emoji but I don't know how to get encoded character of emoji. Please note that I will get saved text from API to display in label. So, I must be able to get it from API and represent it.

Please suggest. Thank you

StackLayout width larger that display width

$
0
0

Hi all!
I need to have a StackLayout or Grid with a width larger that device width.

<StackLayout x:Name="slParent" 
                 Orientation="Horizontal" 
                 HorizontalOptions="FillAndExpand"
                 VerticalOptions="FillAndExpand"
                 BackgroundColor="Red" >
<StackLayout x:Name="slOne" 
                     Orientation="Vertical" 
                     BackgroundColor="Yellow" 
                     WidthRequest="300" />
<StackLayout x:Name="slTwo" 
                     Orientation="Vertical" 
                     BackgroundColor="Orange" 
                     WidthRequest="300" />
</StackLayout>

slTwo is beyond visible area, but width of slParent is equal to the width of the screen.
I tried to use Grid instead of StackLayout but i had the same result.
What do i do wrong?


How would i go about making a 360 degree knob that you are able to turn?

$
0
0

Hi! I'm trying to create a knob that you can spin around in circles and in return get its current position.

https://github.com/corneliu-serediuc/Xamarin.Forms.KnobControl
This Project seemed great and i was able to modify it to my pleasing, but it seems to be using obsolete methods and i couldnt get it to work inside my own project.

How would i go about creating something (very) similar? Where do i start and what do i need to read up on? Thanks in advance!

Xamarin forms Custom toolbar

$
0
0

Hi,
I want to create custom toolbar like this in xamarin forms

how to create?

How to design the week view calender in xamarin forms?

$
0
0

I am confusing, which page i need to use for that carousel page or any other page in xamarin froms

Removing the need for a ViewCell in a ListView ItemTemplate

$
0
0

Hi,

Question
I am wondering when or if it will be possible to use a "View" instead of a "ViewCell" inside a ListView?
As far as I can find, in 3.0 there is still a need for a ViewCell.
(Jason Smith pointed out this would be a 3.0 feature during the Xamarin Forms Build 2017 talk.)

Background info
We are currently extensively using custom ViewCells inside ListViews and TableViews.
However, what we want is a way to use our custom ViewCells in other places as well.
One option would be to build our own TableView based on a StackLayout (very easy) and use a Grid instead of a ViewCell.

Thanks in advance,
Misja

Invalid value for property fontsize

$
0
0

I am setting fontsize in XAML like this :
FontSize="15"

Now changing the value works, font size changes.

So why I am getting a warning saying 'Invalid value for property fontsize'

Convert Image to ByteArray

$
0
0

I have this image in xaml:
<Image x:Name="imageEntry" HeightRequest="240" />
the image will be added after browsing an image from phone gallery. So, when i'll be saving data after clicking save button, I need to get the image and convert to byte array.

async void OnSaveNoteButtonClicked(object sender, EventArgs args)
{
     Image img = imageEntry;
     byte[] imgdata = **Need to convert to byte array--img
     var N_Note = noteEntry.Text;
}

Can someone advice me how to do it. Thank you.

Xamarin Forms iOS - Detect events from hardware keyboard at ContentPage level, no textbox focused

$
0
0

I'd like to be able to accept 1,2,3,4,5,6,7,8,9,0 from hardware a hardware keyboard on my ContentPage, then react to that event in code. I searched here and stack overflow and was unable to come up with anything.

Is this possible with Xamarin Forms (Shared Project sharing, but mostly just for iOS here).


Set column span by using Grid.Children.Add from source code

$
0
0

I have the following source code for setting up a Xamarin.Forms.Grid control on my page. I will like the first 3 rows to expand both columns. The code sample in the online documentation does not really explain how this works.

Here is the source code:

Grid myGrid = new Grid();
myGrid.HorizontalOptions = LayoutOptions.FillAndExpand;

myGrid.RowDefinitions = new RowDefinitionCollection
{
        new RowDefinition { Height = new GridLength(50, GridUnitType.Absolute) },
                new RowDefinition { Height = GridLength.Auto },
                new RowDefinition { Height = GridLength.Auto },
                new RowDefinition { Height = new GridLength(30, GridUnitType.Absolute) }
};

myGrid.ColumnDefinitions = new ColumnDefinitionCollection
{
        new ColumnDefinition { Width = GridLength.Auto },
        new ColumnDefinition { Width = new GridLength(30, GridUnitType.Absolute) }
};

//I need Rows 1,2,3 to span two columns
myGrid.Children.Add(new Label { Text = "Row 1" }, 0, 0);
myGrid.Children.Add(new Label { Text = "Row 2" }, 0, 1);
myGrid.Children.Add(new Label { Text = "Row 3" }, 0, 2);
myGrid.Children.Add(new Label { Text = "Row 4, column 1" }, 0, 3);
myGrid.Children.Add(new Label { Text = "Row 4, column 2" }, 1, 3);

How do I modify the code to have the first 3 rows span 2 columns?

Accessing content property from second View via ViewModel efficently

$
0
0

My ultimate goal, is to have a fixed header on a ContentPage, and then bind the content property to my other views (ContentView) .
I so far have a ViewModel, which i have bound a property called "Viewbound", which is of a "View" data type.

This allows me to access the ViewBound.Content property.

My Problem is I think this is how to assign the content property would be like this;

ViewBound.content = OtherView.content;

This would require a property on the ViewModel for each View (and binding), this doesn't seem that efficient and would have a lot of repeated code?

I can post my full code if required.

How use Device.RuntimePlatform in XAML??

$
0
0

Device.OnPlatform is marked Obsolete: https://docs.microsoft.com/en-us/dotnet/api/Xamarin.Forms.Device.OnPlatform?view=xamarin-forms#Xamarin_Forms_Device_OnPlatform_System_Action_System_Action_System_Action_System_Action_

Docs claim the replacement is Device.RuntimePlatform. So I try to find how to use it. ALL I find is C# code. Huh?

For example, on https://xamarinhelp.com/xamarin-forms-onplatform-runtimeplatform/
@AdamPedley shows XAML using OnPlatform:

    <OnPlatform x:TypeArguments="Thickness">
        <On Platform="Android, UWP">0</On>
        <On Platform="iOS">0,20,0,0</On>
    </OnPlatform>

And then the replacement which is in C#:

switch(Device.RuntimePlatform)
{
case Device.iOS:
    this.Padding = new Thickness(0,20,0,0);
    break;
case Device.Android:
case Device.UWP:   
case Device.macOS:
default:
    // This is just an example. You wouldn't actually need to do this, since Padding is already 0 by default.
    this.Padding = new Thickness(0);
    break;
}

??? That isn't a replacement for a feature that works in XAML - that's C# code.

Explanation please. Is this useable in XAML? Will be in the future?

Can I disable ViewCell.ContextActions based on a condition

$
0
0

Hi I using a Xamarin Forms ListView and I want to know if I can disable the Context Actions based on a certain binding or in the code behind
I am using one GroupedListView for the whole application but it displays different data based on what the user is doing. There is a "Manage your Favorites" feature where I want the user to be able to swipe-to-delete on iOS or long-press on android to remove a ListItem, but I do not want this behavior if the list is displaying some search result or something else

<ViewCell.ContextActions>
    <MenuItem Text="Delete" IsDestructive="true" CommandParameter="{Binding .}" Command="{Binding Path=BindingContext.OnDeleteCommand, Source={x:Reference Name=ListViewPage}}"/>
</ViewCell.ContextActions>

This did not disable it...

<ViewCell.ContextActions IsEnabled="false"> //This IsEnabled does nothing
    <MenuItem Text="Delete" IsDestructive="true" CommandParameter="{Binding .}" Command="{Binding Path=BindingContext.OnDeleteCommand, Source={x:Reference Name=ListViewPage}}"/>
</ViewCell.ContextActions>

How to open specific page after clicking on notification when the app is closed?

$
0
0

I'm actually working on a Xamarin Forms application that need push notifications. I use the Plugin.PushNotification plugin.

When the app is running in the foreground or is sleeping (OnSleep), I have no problem to open a specific page when I click on a notification that I receive. But I was wondering how can I do that when the app is closed. Thanks!

Viewing all 91519 articles
Browse latest View live


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