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

Text of Radio Buttons not showing anymore

$
0
0

After Updating from 4.7.0 968 to 4.8.0 1238 I was facing Problem with my Radio Buttons. I don´t know from which Version it startet but I downloaded the official Demo for Radio Buttons from the Xamarin Page and I have the same Problem.


Does Xamarin native include any default fonts or font families?

$
0
0

I'm looking at setting the font for the app I'm currently working on.

I'm okay with simply adding a .tff file and marking it as an embedded resource, but I'm wondering if there might be a set of in-built fonts that can be accessed without needing to add anything extra like that.

For example, I could just write FontFamily = "FontFamilyName" and it will know what to do already. Similar to specifying certain font styles in web development.

I know the default font library for each platform will be different. What I don't know is what those defaults are (if any). Is there a list somewhere? Googling seems pretty sparse on results.

Cheers.

tabs of tabbed pages have disappeared

Bindable Property

$
0
0

Is it possible to make Bindable property for boolean with family font icon.

please help on this

How do I use an SVG image as a clickable button with non-hover, hover and clicked states?

$
0
0

Please check the attached image; you will find an SVG image that can be opened in Google Chrome. This vector was created by myself to then use as a Button Control with the above-mentioned states (non-hover, hover and clicked states).

Currently I'm using Syncfusion's SfButton control to display the SVG as the SvgImageSource.

The code:

   <buttons:SfButton
                      HorizontalOptions="Center"
                      VerticalOptions="Center"
                       >
    <Image>
        <Image.Source>
                <svg:SvgImageSource Source="Resources/Next-btn-clicked-state.svg" Width="100" Height = "40"/>
        </Image.Source>

    </Image>
                <buttons:SfButton.BackgroundImage>
            <svg:SvgImageSource Source="Next-btn-clicked-state.svg" Width="100" Height="40" />
        </buttons:SfButton.BackgroundImage>
    </buttons:SfButton>

Please find the other attached image which is the emulator screen showcasing an incorrect display of the SVG image.

I don't know if what i'm doing is the correct procedure, please let me know thanks!

Xamarin Forms: Load a contentpage when tap push notification android

$
0
0

I completed receiving test notification from FCM console. Now I am trying to open a page when tapping the notification. Any ideas about how to achieve this? I have searched the internet but can't find a working solution. I am also able to send the notification through the postman.

SQLite query not working in iOS but works in Android

$
0
0

Hi

I develop an application in Xamarin.forms, Its strange, because the query working in Android very well, but in iOS dont. The Other queries working well

public List<Datas> GetItemsByDate(DateTime date, int category = 0)
        {
            var fromDate = DateTime.ParseExact(date.ToString("YYYY-MM-dd") + " 00:00:01", "YYYY-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
            var toDate = DateTime.ParseExact(date.ToString("YYYY-MM-dd") + " 23:59:59", "YYYY-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);

            if (category == 0)
            return connection.Table<Datas>().Where(data => (data.OperationDate >= fromDate &&
                                                            data.OperationDate <= toDate)).ToListAsync().Result;

            return connection.Table<Datas>().Where(data => (data.OperationDate >= fromDate &&
                                                               data.OperationDate <= toDate && data.AlarmLevel == category)).ToListAsync().Result;
        }

The Query purpose to query 1 single day from database.

Somebody faced this strange problem before?

Get Html source from a website

$
0
0

hello community,

Is there another way to get Html source from a website? I tried it with HtmlAgilityPack, but its not working with .winPhone and .ios project.
I need it for my Xamarin.Forms project. In another discussion i found the same problem like i have, but the solution is not working for me.
Thanks for helping


I want to create a service which run every time.

$
0
0

I want to implement a service which run every time when app start.

Html Agility Pack Could not load

Tabbed page is set to the rest of the pages

$
0
0

Hello everyone
I have taken one tabbed page in xamarin project and calling content page from the buttons from tabs but unfortunately
whichever content pages are calling from the button will show the bottom tabs constantly.
I have no clue why the xamarin bottom tabs are sticks to the entire project
Please help!!

How to add TextChanged event to a CustomControl in Xamarin.Forms?

$
0
0

I created a custom control for a specific requirement. But the entry is lying as a child element of that control. The parent control is a ContentView. I want to know how can I create and trigger the TextChanged, Focused and UnFocused events that is included in the entry through my custom control. Please help me on making one of the event work so I can create others on my own. Thanks

CustomControl -

<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="dewebey.CustomControls.CustomEntryWithHint">
    <Grid ColumnDefinitions="*,60" RowDefinitions="auto,40,auto" RowSpacing="5">
        <BoxView Grid.RowSpan="2" Grid.ColumnSpan="2" BackgroundColor="White" Margin="0,0,0,8"/>

        <Label x:Name="HintLabel" Grid.ColumnSpan="2" Text="" TextColor="Black" FontSize="Micro" FontFamily="Bold" Margin="24,0,20,0"/>
        <Entry x:Name="entry" Grid.Row="1" Grid.ColumnSpan="2" VerticalOptions="FillAndExpand" Margin="20,0,20,0" IsPassword="True"/>
        <ImageButton x:Name="ShowHidePassword" Grid.Row="1" Grid.Column="1" Source="show_default.png" HorizontalOptions="End" BackgroundColor="Transparent" VerticalOptions="Start" Padding="15,5,5,10" Margin="0,0,20,0" Clicked="ShowPassword_Clicked" IsVisible="False"/>

        <Label x:Name="ErrorLabel" Grid.Row="2" Grid.ColumnSpan="2" Text="" TextColor="#C63A4A" FontSize="Micro" FontFamily="Bold" Margin="24,-5,20,0" IsVisible="False"/>
    </Grid>
</ContentView>

Using the CustomControl in a Page -

<customcontrols:CustomEntryWithHint Hint="Password" HasError="False" Error="Wrong Password" IsPassword="True"/>

How to translate my label with Binding an enum type in a ListView

$
0
0

Hi,
I try to show some text in my label who's from a class with enum values then i need to translate it, I use this in my xaml :
xmlns:translator ="clr-namespace:MultilingualSample.Droid.Helpers"

Then I try this but it doesn't work:

Any Idea ? Thanks a lot !!!!

Offline Sync - Xamarin Forms

$
0
0

Hi,
There was some discussion few years back to use Azure Mobile Services for Offline functionality and automatic sync when connected to network.
It seems this approach is deprecated.

From Xamarin & Microsoft, do we have any best approach to fulfill this need? Any suggestions?

MVVM: how to update an item inside a lstview with the text property of a button in the same lstview

$
0
0

Hi. Sorry if my English is rough, Spanish is my native language.

  1. I'm using MVVM.
  2. I have a collection of items inside a listview and each one has 2 buttons.
  3. Button.Text property is variable. It is the result of a convertion based on a property of the collection item.
  4. Both buttons use the same command.

I want to update the collection item with the random Button.Text generated in the convertion. How can I do that?

// =============================
//Model.cs

public class SomeClass 
{
    public string ItemType {get;set;}
    public string ButtonTextProperty {get;set;}
}
// =============================

// =============================
// ViewModel.cs

public Command SomeCommand { get; set; }

public ControlObjetosChecklistsViewModel()
{
    this.SomeCommand = new Command(async (object param) => await someCommand (param));
}

private async Task someCommand(object param)
{
    // get the object by taking the button bindingcontext
    // get button text property
    // update object with that text property
}
// =============================

// =============================
//View.xaml
<ListView x:Name="listView" ItemsSource="{Binding ItemSource}" SelectionMode="None" HasUnevenRows="True">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                        <Button x:Name="btn1" 
                                                Text="{Binding ItemType, Converter={StaticResource converter}, ConverterParameter=converterparameter1}" 
                                                Command="{Binding Source={x:Reference listView}, Path=BindingContext.SomeCommand}" 
                                                CommandParameter="{Binding .}" 
                                                HorizontalOptions="FillAndExpand"/>
                                        <Button x:Name="btn2" 
                                                Text="{Binding ItemType, Converter={StaticResource converter}, ConverterParameter=converterparameter2}" 
                                                Command="{Binding Source={x:Reference listView}, Path=BindingContext.SomeCommand}" 
                                                CommandParameter="{Binding .}"   
                                                HorizontalOptions="FillAndExpand"/>
                                    </StackLayout>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
</ListView>
// =============================

Two spans on the multiline label with intercepted events have an incorrect behavior

$
0
0

I have created this simple example.

<StackLayout Margin="20">
            <Label Text="Demo"
               HorizontalOptions="Center"
               FontAttributes="Bold" />
            <Label>
                <Label.FormattedText>
                    <FormattedString>
                        <Span Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, .... " />
                        <Span Text="first"
                          TextColor="Blue"
                          TextDecorations="Underline">
                            <Span.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding TapCommand}" />
                            </Span.GestureRecognizers>
                        </Span>
                        <Span Text=" and " />
                        <Span Text="second"
                          TextColor="Blue"
                          TextDecorations="Underline">
                            <Span.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding TapCommand2}" />
                            </Span.GestureRecognizers>
                        </Span>
                    </FormattedString>
                </Label.FormattedText>
            </Label>
        </StackLayout>

I have two spans on the multiline label with intercepted events. On Android, when i clicked on "second" the first event is also called

Color palatte in xamarin

$
0
0

Hello everyone!
as am new to this platform I don't know how to achieve this in xamarin
I want a color palette in xamarin where I can select any one color and write code on the selection of colors

Is it possbile get facebook post likes count xamarin forms without SDK?

Build Options iOS

$
0
0

I am Curious what is the best build option .

x86_64 or i386 + x86_64

i386 is for older iphone like 4s or 5 i think , but what is most used ?

And what about LLVM optimizing compiler

How can I duplicate a Label with Bounds data that is immediately ready to use?

$
0
0

I need to make a copy of a label and immediately perform calculations on it using the VisualElement.Measure() function. The reason I need to make a copy is that I sometimes manipulate the label data (mostly the text) and I don't want to modify the original label at all. Unfortunately, I haven't found a way to properly do this.

Here's what I've tried to so far:

Attempt #1: referencing the object

Label myCopy = origLabel;
myCopy.Text = origLabel.Text;

Doesn't work because: Yes, this was silly. Those of you who've tried this before know this is only a shallow copy, so myCopy only points to the same data in memory. Changing myCopy changes the original. Bad for me.

Attempt #2: Making a deep copy: I initially looked at this post for possible solutions.
Two ways I've seen to make a deep copy:
1. Implement ICloneable. I am using a static class and can't implement ICloneable. :disappointed:
2. Use a JSON converter to serialize and then deserialize the object data. I tried this using a few different JSON packages, but I got an exception about a self-referencing loop related to the label's children. I don't know if there's a way around this.

Attempt #3: Make a new label and copy some values

Label myCopy = new Label() {
                Text = String.Copy(origLabel.Text),
                WidthRequest = origLabel.WidthRequest,
                HeightRequest = origLabel.HeightRequest
            };

Doesn't work because: The width and height of myCopy are -1 until they go through a layout pass (which they will never have a chance to do naturally), so Measure() tries to measure them without the correct bounds values, even if I try to add the size requests like above

So what can I do? Are there any fixes for these issues? Or simply other options?

For example, perhaps there is a fix for the JSON exception that I haven't seen. But would a deep copy even work for the size values? Or maybe I can force the new label to size itself before I do my calculations?

I've been noodling over this for quite some time, and any help is appreciated.

Viewing all 79144 articles
Browse latest View live


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