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

When can we expect forms 3.0? What's the status of the pre-release

$
0
0

Hi everyone, long time no speak!

Been away from Xamarin land for a couple of years and was excited about Forms 3.0; last I heard it was out Q4, and we're at April now practically, without a peep; just a pre-release a few months back..

Is it gonna get release? If so when? Is it wise to start a new project in Forms 3.0? So many questions!!! :)


how to create a table in xamarin in which i putt data dynamically

$
0
0

hello, plz help me i am work on a project in which i want to create a table for only show the data, but i want to insert data in table dynammically like listview i also want the header of that table can also putt dynammically.

XForms 1.3.2: Can OnPlatform be used with ResourceDictionary.Styles?

$
0
0

Does anyone of if you can specify OnPlatform declarations when using Styles? I've tried a few different things but can't get it to work. My last attempt looked liked this:

`

<ResourceDictionary>
    <Style x:Key="ButtonStyle" TargetType="Button">
        <Setter Property="VerticalOptions" Value="Center" />
        <Setter Property="HorizontalOptions" Value="Center" />

        <Style.Setter.Property.HeightRequest>
            <OnPlatform x:TypeArguments="x:Double" iOS="94" Android="100" />
        </Style.Setter.Property.HeightRequest>

        <Style.Setter.Property.WidthRequest>
            <OnPlatform x:TypeArguments="x:Double" iOS="94" Android="100" />
        </Style.Setter.Property.WidthRequest>
    </Style>
</ResourceDictionary>

`

Where are the XAML designer tools?

$
0
0
Years have past ;-) not really but I think this question has been asked many Times' before.

The forms previewer crash all the time. It could be seen more of a compile:designer that breaks as soon as you start adding codebehind stuff.

We need a designer for Xaml not css? I think the web guys gonna stick to other tools anyways
The live previewer very nice idea, same thing doesn't work yet.

I just need BLEND with a Visual state manager. where is the backning from the Microsoft team that dream up stuff like the Blend tools :-)

Mixing native UWP pages and Xamarin Forms pages

$
0
0

I am trying to get a demo working that will allow me to include navigation native UWP pages and pages build using Xamarin Forms.

When I try and use the rootFrame to navigate to the first XF page I get a AccessViolationException from this code

return this._frame.Navigate(viewType, parameter);

Any thoughts as to why this might happen?

I have tried forcing the code to run on the UI thread but that didn't help
I have seen reports of that exception from WinRT when XAML pages are defined in a different assembly but I have tried navigating to native [ages in a second assembly and that worked fine so i don't think that is the issue.

How to have multiple pages inside a page

$
0
0

Hi,

I need to have two section on the same page.
The top section(or 1st section) being the static on the page while the bottom(or 2nd section) section having multiple modelling pages on it.

Kindly suggest how it is achievable.

Thanks in advance.

java.lang.ClassCastException on performLaunchActivity

$
0
0

Hello,

I use a crash tracker to report the crash on my app and since few weeks I see the following crash on Android :

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.myapp/md52adb867d6e80e379ca1e69bf6644c3be.MainActivity}: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.ProgressBar$SavedState
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2474)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5608)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1397)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1192)

I've no idea of what does it mean. I read a stackoverflow thread talking about this kind of exception but this doesn't help me a lot.
(https://stackoverflow.com/questions/15298184/unexplainable-classcastexception-in-android-widget-progressbar-onrestoreinstance)

Florian.

Bottom navigation bar unwanted space

$
0
0

This my Xaml code:




    <StackLayout VerticalOptions="EndAndExpand" Padding="0" Spacing="0" Margin="0" HorizontalOptions="FillAndExpand"
                      RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                      RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.90}"
                      RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.1}">

        <Grid   BackgroundColor="#e8eaf6" Padding="0" Margin="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <StackLayout Orientation="Vertical" Grid.Column="0" HorizontalOptions="CenterAndExpand" VerticalOptions="Center">
                <Image  Source="bb_YayinEkrani.png"  WidthRequest="30" HeightRequest="30" Opacity="0.6" />

            </StackLayout>

            <StackLayout Orientation="Vertical"  Grid.Column="1"  HorizontalOptions="CenterAndExpand" VerticalOptions="Center">
                <Image Source="bb_HaberMasasi.png" WidthRequest="30" HeightRequest="30"  Opacity="0.6">
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer Tapped="ImgHaberMasasi_Tapped"/>
                    </Image.GestureRecognizers>
                </Image>

            </StackLayout>

            <StackLayout Orientation="Vertical"  Grid.Column="2"  HorizontalOptions="CenterAndExpand" VerticalOptions="StartAndExpand">

                <Image  Source="aalogo2.png"  WidthRequest="40" HeightRequest="40" >
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer Command="{Binding SlideOpenCommand}" Tapped="Logo_Tapped"/>
                    </Image.GestureRecognizers>
                </Image>
            </StackLayout>
            <StackLayout Orientation="Vertical"  Grid.Column="3"  HorizontalOptions="CenterAndExpand" VerticalOptions="Center">
                <StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand" VerticalOptions="Center">
                    <Image  Source="bb_Bell.png"  WidthRequest="30" HeightRequest="30" Opacity="0.6"/>
                   <badge:BadgeView Text="21" BadgeColor="Red" VerticalOptions="Start" HorizontalOptions="End" />
                </StackLayout>

            </StackLayout>
            <StackLayout Orientation="Vertical"  Grid.Column="4"  HorizontalOptions="CenterAndExpand" VerticalOptions="Center">
                <StackLayout Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="Center">
                    <Image  Source="bb_Profile.png"  WidthRequest="30" HeightRequest="30" Opacity="0.6">
                        <Image.GestureRecognizers>
                            <TapGestureRecognizer Tapped="ImgProfile_Tapped"/>
                        </Image.GestureRecognizers>
                    </Image>
                    <badge:BadgeView Text="8" BadgeColor="Red" VerticalOptions="Start" HorizontalOptions="End" />
                </StackLayout>

            </StackLayout>
        </Grid>
    </StackLayout>
</RelativeLayout>

Xamarin.Auth and Twitter Login Error

$
0
0

Hello,

I'm a newbie in Xamarin and I'm trying to achieve something simple... I have a button and I want to Login with Twitter (I'm working on Android).

On shared code I have:
`public void StartTwitterLogin()
{
var auth = new OAuth1Authenticator(
consumerKey: "*******************",
consumerSecret: "*********************************************************",
requestTokenUrl: new Uri(twitter.requestTokenUrl),
authorizeUrl: new Uri(twitter.authorizeUrl),
accessTokenUrl: new Uri(twitter.accessTokenUrl),
callbackUrl: new Uri(twitter.callbackUrl)
);
auth.AllowCancel = false;
auth.Completed += OnAuthCompleted;
auth.Error += OnAuthError;
var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
presenter.Login(auth);

            }

`
So I have this function bonded to my button. But when I click it, it launches an alert saying "socket not connected"... anyone can help?

Thank you in advance

Capture app crash report and write into text file

$
0
0

I would like to ask is there even possible to capture app crash report from the phone and write it into another text file?

How to open other apps from xamarin forms

$
0
0

How to open other apps from xamarin forms ?
or
How to open other apps from xamarin forms apps

[android] label renderer apply to all labels

$
0
0

I have forms app, and I have custom label as following,

public class HtmlFormattedLabel : Label
    {
        public float mySize { get; set; }
    }

and I have custom renderer in both android and ios as following:

Android:

[assembly: ExportRenderer(typeof(HtmlFormattedLabel), typeof(HtmlFormattedLabelRenderer))]
namespace HBRS.Droid.Renderers
{
    public class HtmlFormattedLabelRenderer : LabelRenderer
    {

        public HtmlFormattedLabelRenderer(Context context) : base(context)
        {

        }
        protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
        {
            base.OnElementChanged(e);

            HtmlFormattedLabel view = (HtmlFormattedLabel)Element;
            if (view == null) return;

            Control.Gravity = Android.Views.GravityFlags.Right;
            Control.SetTextSize(Android.Util.ComplexUnitType.Sp, view.mySize);

            if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.N)
                Control.SetText(Html.FromHtml(view.Text.ToString(), FromHtmlOptions.ModeLegacy), TextView.BufferType.Normal);
            else
                Control.SetText(Html.FromHtml(view.Text.ToString()), TextView.BufferType.Normal);
        }
    }
}

iOS

    [assembly: ExportRenderer(typeof(HtmlFormattedLabel), typeof(HtmlFormattedLabelRenderer))]
    namespace HBRS.iOS.Renderers
    {
        public class HtmlFormattedLabelRenderer : LabelRenderer
        {
            protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
            {
                base.OnElementChanged(e);

                var view = (HtmlFormattedLabel)Element;
                if (view == null) return;
                UIStringAttributes te = new UIStringAttributes();
                var attr = new NSAttributedStringDocumentAttributes();
                var nsError = new NSError();
                attr.DocumentType = NSDocumentType.HTML;
                attr.StringEncoding = NSStringEncoding.UTF8;
                attr.ViewMode = NSDocumentViewMode.PageLayout;
                Control.AttributedText = new NSAttributedString(view.Text, attr, ref nsError);
            }
        }
    }

the problem that in android, the renderer applied to all labels in the app, (when I change size of the custom label all the label sizes changes)

ListView inside CarouselView : Scroll hardly

$
0
0

Hey,

I created a Listview inside a CarouselView, but when i want to scroll in my listview, my carousel can take the focus and it can horizontal scroll too.

How can I lock my carouselView ?

Thanks

SearhBox (Multiselect page)

$
0
0

I have an ObservableCollection with list of users data which is wrapped for multiselect page.
I added SearhBox to the multiselect page but I can not make it work.
Here is an example of code:

public class WrappedItemSelectionTemplate : ViewCell
            {
                public WrappedItemSelectionTemplate() : base()
                {


                    Label Title = new Label() { TextColor = Color.Black };

                    Title.SetBinding(Label.TextProperty, new Binding("Item.Title"));
                    Label Email = new Label() { FontSize = 14 };

                    Email.SetBinding(Label.TextProperty, new Binding("Item.Email"));

                    Switch mainSwitch = new Switch() { HorizontalOptions = LayoutOptions.End };
                    mainSwitch.SetBinding(Switch.IsToggledProperty, new Binding("IsSelected"));


                    StackLayout Stack = new StackLayout();

                    Stack.Children.Add(Title);
                    Stack.Children.Add(Email);
                    Grid grid = new Grid();
                    grid.Children.Add(Stack, 0,0);
                    grid.Children.Add(Email, 0, 1);
                    grid.Children.Add(mainSwitch, 1, 0);
                    View = grid;
                }
            }
            public List<WrappedSelection<T>> WrappedItems = new List<WrappedSelection<T>>();

            public SelectMultipleBasePage(List<T> items)
            {
                WrappedItems = items.Select(item => new WrappedSelection<T>() { Item = item, IsSelected = false }).ToList();
                ListView mainList = new ListView()
                {
                    ItemsSource = WrappedItems,
                    ItemTemplate = new DataTemplate(typeof(WrappedItemSelectionTemplate)),
                };

                mainList.ItemSelected += (sender, e) =>
                {
                    if (e.SelectedItem == null) return;
                    var o = (WrappedSelection<T>)e.SelectedItem;
                    o.IsSelected = !o.IsSelected;
                    ((ListView)sender).SelectedItem = null; //de-select
                };

                // SearchBar added
                StackLayout Stack = new StackLayout();
                SearchBar Search = new SearchBar(); 
                Stack.Children.Add(Search);
                Stack.Children.Add(mainList);
                Search.TextChanged += (sender, e) =>
                {
                    SearchBar_TextChanged();
                };
                Content = Stack;

                void SearchBar_TextChanged()
                {


                }
            }

When I ussed SearchBox in my cases before I was filtering an ObservableCollection like:

new ObservableCollection<Models.M_UsersAndGroups>(
from user in userList           
where (!String.IsNullOrEmpty(user.Title) && user.Title.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0) 
select user)

But I can't do the same because it's wrapped. How I can use SearhBox for field Title in that case?

Xamarin forms long press gesture recognizer in listview

$
0
0


<ListView.ItemTemplate>


<ViewCell.View>

<Grid.ColumnDefinitions>



</Grid.ColumnDefinitions>

<lb:Gestures.Interests>



</lb:Gestures.Interests>

<Image.GestureRecognizers>

</Image.GestureRecognizers>

                                                        <Image.GestureRecognizers>
                                                            <TapGestureRecognizer Command="{Binding GuideLineCommand, Source={x:Reference StartPage}}" CommandParameter="{Binding ImageSource1}" />
                                                        </Image.GestureRecognizers>
                                                    </Image>
                                                    <Image Source="{Binding ImageSource3}" Grid.Column="2" BackgroundColor="White" >

                                                        <Image.GestureRecognizers>
                                                            <TapGestureRecognizer Command="{Binding GuideLineCommand, Source={x:Reference StartPage}}" CommandParameter="{Binding ImageSource1}" />
                                                        </Image.GestureRecognizers>

                                                    </Image>

                                                </lc:GesturesContentView>
                                            </Grid>
                                        </ViewCell.View>
                                    </ViewCell>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>

my code

i want to add long press function for image in listview
but i don`t know how to do

<Image.GestureRecognizers>
</Image.GestureRecognizers>

how to use two function singleTap and Longpress

help me plz


OxyPlot initialize renderer error

$
0
0

I need to do some basic plotting in my App with the help of the OxyPlot NuGetPackage extension. I have followed the online tutorials on how to set it up and as far as i can tell i did it correctly. I put the Init call to initiate the renderer right after the Xamarin.Forms.Forms.Init in every of the 3 Folders(Android, IOS, UWP) like so(Android as example):
base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init(); LoadApplication(new App());

Now everytime i start the app i get an exception along the lines of:"Visualization error. Dont forget to initialize renderer in Android MainActivity.cs" which I clearly did. I'm getting really frustrated at this as i cant find any fix on the Interwebs and other plotting libraries seem way too cumbersome to use. I would appreciate any help i can get!
Thanks beforehand

How can I display ListView in Xamarin.Android Alert Dialog?

$
0
0

I want display Listview inside the Android Alert Dialog.

Please help me, anyone

    void SetDialog(IList<OrderInfo> orders, string contactGuid){

    var dialogView = this.BindingInflate(Resource.Layout.guest_name_list, null);

    var dialog = new AlertDialog.Builder(this.Context);
    dialog.SetView(dialogView);
    dialog.SetNegativeButton("Cancel", (s, a) => { });
    AlertDialog alertDialog = dialog.Create();
    alertDialog.Show();

    dialogView.FindViewById<TextView>(Resource.Id.AlertTitle).SetText(PartyDetailsViewModel.EditAddOrderActionTitle, null);
    dialogView.FindViewById<TextView>(Resource.Id.AlertTitleMessage).SetText(PartyDetailsViewModel.EditAddOrderActionMessage, null);
    dialogView.FindViewById<TextView>(Resource.Id.AddOrderButton).SetText(PartyDetailsViewModel.AddOrderButtonTitle, null);
    dialogView.FindViewById<TextView>(Resource.Id.AddOrderButton).Click += delegate {
        this.ViewModel.SelectedOrder = (PartyDetailsViewModel.AddOrderButtonTitle, contactGuid);
        alertDialog.Dismiss();
    };
   dialogView.FindViewById<ListView>(Resource.Id.GuestNameList).SetAdapter();
}

Xamarin TapGestureRecognizer - VB Example

$
0
0

I'm trying to add an Xamarin.Forms TapGestureRecognizer onto a stacklayout in code behind in VB.

I've Converted this code from an Xamarin example here:

xxxx://github.com/xamarin/xamarin-forms-samples/blob/master/Xuzzle/Xuzzle/Xuzzle/XuzzlePage.cs

`TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer {
Command = new Command (OnSquareTapped),
CommandParameter = square
};
square.GestureRecognizers.Add (tapGestureRecognizer);

async void OnSquareTapped (object parameter)
{
//do something
}`

When I convert to VB, I get the following code.

`Private tapGestureRecognizer As TapGestureRecognizer = New
TapGestureRecognizer With {.Command = New Command(OnSquareTapped),
.CommandParameter = square}

Private Async Sub OnSquareTapped(ByVal parameter As Object)
//do something
End Sub`

'Argument not specified for parameter'

Then when I add a parameter I get

'Expression does not produce a value'

If I change OnSquareTapped to a Function I get

'the Overload resolution failed...'

I can't find a working example anywhere in VB and a lot of the C# examples either use depreciated methods or Lamda, which I'm not familiar with.

Can anyone provide a working VB example - with an explanation as to where I'm going wrong?

How to collapse a row in a grid?

$
0
0

I've a view with a grid with 3 rows. In the first row ( 0 ) there is an image like as header. I wish to collapse the row0 when I tap on image to I've more space in the view.
How doing?

Using xamarin forms mvvm how to set tab bar at bottom of the page in android like as ios?

$
0
0

I working on xamarin forms using MVVM. I want to set tabs on bottom in android like as tabs on iOS. If any one have idea about that let me know.

Thanks in advance :)

Viewing all 77050 articles
Browse latest View live


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