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

About data base

$
0
0

Tengo una app desarrollada en xamarin forms con visual studio 2017, la app tiene una base de datos la cual genero una vez que ejecuto la aplicacion, ahora bien, lo que nesecito es saber como puedo obtener ese archivo(base de datos) porque no la veo por ningun lado....asi creo mi base de datos con sus correspondientes tablas

if (database == null)
{
database = new Database(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Infractores.db3"));
}
return database;

El emulador que utilizo es el nox player 6.6

Y como puedo hacer para que la app se me conecte a un servidor externo donde estara esa base de datos y poder consumir datos de ella
saludos y gracias por addelantado

################ English

I have an app developed in xamarin forms with visual studio 2017, the app has a database which I generate once I run the application, now what I need is to know how I can get that file (database) because I don't I see nowhere ... so I create my database with its corresponding tables

if (database == null)
{
database = new Database (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData), "Violators.db3"));
}
return database;

The emulator I use is the nox player 6.6

And how can I make the app connect to an external server where that database will be and be able to consume data from it
greetings and thanks in advance


Touch and LongClick event on the same view in Android

$
0
0

Hi,

I have a use case with a Collectionview with custom views where a click/touch on a item will open a new page and a longclick will open a popup with some options for the view in the collection (remove, edit, etc).

From what I understand I can't implement this in Forms, I would have to use an effect or custom renderer. I thought I would be able to use the TouchEffect effect from the Xamarin documentation and its been working great for the Touch to open.
Now I would like to be able to use a LongClick/LongPress interaction as well. I've decided to modify the existing TouchEffect effect so that it also can fire a LongPressEvent. My TouchEffect class now looks like this:

public class TouchEffect : RoutingEffect
    {
        public event TouchActionEventHandler TouchAction;

        public event EventHandler<EventArgs> LongPressAction;

        public TouchEffect() : base("XamarinDocs.TouchEffect")
        {
        }

        public bool Capture { set; get; }

        public void OnTouchAction(Element element, TouchActionEventArgs args)
        {
            TouchAction?.Invoke(element, args);
        }

        public void OnLongPressAction(Element element, EventArgs args)
        {
            LongPressAction?.Invoke(element, args);
        }
    }

This works great in iOS, for the iOS platform effect I just added a UILongPressGestureRecognizer to the view and call the OnLongPressAction in its callback.

For Android I thought that I would be able to do the same and just add a callback to view.OnLongClick and call OnLongPressAction from there.
This does not seem to work since I also have a callback for view.OnTouch that sets the event.Handled to true, and setting event.Handled to false would mean that that other events like MotionEventActions.Up wont fire.

I read here that if I want to be able to use both OnClick and OnTouch that I would need a GestureDetector. Does that mean that I need a custom renderer? Is there any other way to solve this?
Any input would be greatly appreciated.

Image from URL in MenuItem

$
0
0

Hello,
I just started developing Xamarin mobile apps.

I have one challenge that I cannot get around at the moment.

I planned to use AppShell to implement navigation. In my flyout header I placed an image with a URL to the image:

    <Image Aspect="AspectFit" 
           Source="https://xxxx.com/api/App/Download?fileId=5eb2a0a7e6865ba3c8c7ae32" 
           Opacity="0.9" />

That works great.

In my menu I need to show a list of menu items which is dynamic (for example companies) and I want to place an icon in front of it in the menuitem (the logo).

Unfortunately the MenuItem element is not accepting image sources from an url.

        this.Items.Add(new MenuItem() {  IconImageSource= "https://anyurl.com", Text = "Test", Command = ExecuteClientList, CommandParameter = "12" });

This does not work.

Is there a work around for that? Or is there another element instead of MenuItem to use instead?

Thanks in advance.

how set Loading image - Error image to Image

$
0
0

I don't want to use this plugin ffimageloading

Introduce new tools

not show image

$
0
0

        <Image Source="https://www.cdn.vatanbgs.com/Content/Images/Products/460_466/637089327869489423.jpg" Aspect="Fill" HeightRequest="150"/>
        <Image Source="https://cdn.vatanbgs.com/Content/Images/Products/460_466/637089327869489423.jpg" Aspect="Fill" HeightRequest="150"/>

        <Image Source="https://www.blogfa.com/static/images/blogfa-logo.gif" Aspect="Fill" HeightRequest="150"/>
        <Image Source="https://blogfa.com/static/images/blogfa-logo.gif" Aspect="Fill" HeightRequest="150"/>

Why don't the photos open? cdn.vatanbgs

android
5
4.3
4.2

API Rest

$
0
0

What is the best way to create an api rest in xamarin forms

How to detect scroll in Shell Flyout?

$
0
0

Hi!
I set FlyoutHeaderBehavior="CollapseOnScroll" and want to hide user image and show user name only when it is collapsed. How can I detect header collapsing?
Thanks!


Using custom font in Xamarin adds extra spacing below and above the text

$
0
0

Hello

I would like to use custom ( imported ttf ) font in Xamarin. I use Xamarin.Forms 4.4, I put ttf into Assets folder of my android project.
But when I display some text with this font, text is displayed with extra spacing above and below text ( red bordered areas on pic)

The VerticalTextAlignment works fine, but I don't know what are these spaces ( I guess these spaces are gaps between top and ascent values of font , and bottom and descent values of font) and how can I remove them? I tried set font metrics with fontforge (on Element -> Font info->OS/2->Metrics pane) but no effect.

I tried other ttf font, that font has extra spacing too, but size of spacing above and below text was different.

Xaml for upper Sample text:
<Label Text="Sample text" FontFamily="font.ttf#font name" FontSize="26" LineHeight="12" FontAttributes="Bold" VerticalOptions="End" VerticalTextAlignment="Start" BackgroundColor="Aqua" Padding="0" Margin="0" HeightRequest="100"/>

Xaml for other Sample text:
<Label Text="Sample text" FontFamily="font.ttf#font name" FontSize="26" LineHeight="12" FontAttributes="Bold" VerticalOptions="End" VerticalTextAlignment="Start" BackgroundColor="Aqua" Padding="0" Margin="0"/>

Thanks for your help


How to locally save notification when app is terminated

$
0
0

Hello everyone. I am using one signal for notification but i have a problem. I have to locally save the notifications. But I cant do it when the app is terminated.

Unexpected Memory leaks shown by Xcode's Instrument tool

$
0
0

Hi,
I have a problem related to memory leaks shown by Xcode's Instrument tool.

I have used Visual Studio 2017 on windows 7 machine connected to mac build host.

I have created Xamarin project in Visual Studio 2017 as follows:

File->New->Project->Cross-Platform->Mobile App(Xamarin Forms)->Blank(iOS, .NET Standard)
Note: I have added No extra code from my side

This project is successfully executed on iPhone5s Simulator (12.1)

Then i used instrument tool (Leak Check)

It showed following leaks.

Question: Why these leaks occur on standard project and How to fix them.

Image-1

Image-2

Image-3

Image-4

Image-5_1

Image-5_2

Image-6

Image-7

Label Text binding does not work when I also use IsVisible binding

$
0
0

Hi,

I have a label with two bindings: Text binding and also IsVisible binding.

I have a special situation where I cannot see the content of my label. I know the label control is there because the space is reserved in the UI but no value is displayed. When I start the simulator in debug, I see the problem. Even if I go around the app, the problem is always there. But if I update the Label control and save (hotswap), after the refresh of the App, the problem is fixed!?!

Here is my model. Each ListViewItem has a small arrow at the bottom and when I click on it, I want to hide the label and show another section. When I click again on the arrow, hide the section and show the label. Just toggle between these two.

public class EvaluationContextMemberCell : INotifyPropertyChanged, IProfileUniform
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public EvaluationContextMemberDto EvaluationContextMember { get; set; }

    ...    

        #region Position
        public bool HasPosition { get { return EvaluationContextMember.Profile.Position.IsNotEmpty(); } }

        public bool ShowPosition { get { return HasPosition && !ShowProperties; } }
        #endregion

    .. 

        #region Properties
        public List<ProfilePropertyDto> Properties
        {
            get
            {
                List<ProfilePropertyDto> properties = new List<ProfilePropertyDto>(EvaluationContextMember.Profile.Properties);

                if (EvaluationContextMember.Profile.Subject.Gender.HasValue)
                {
                    ProfilePropertyDto dto = new ProfilePropertyDto
                    {
                        Name = AppResources.Gender,
                        Value = EvaluationContextMember.Profile.Subject.Gender == 2 ? AppResources.GenderFemale : AppResources.GenderMale
                    };
                    properties.Insert(0, dto);
                }

                if (EvaluationContextMember.Profile.Subject.Date.HasValue)
                {
                    DateTime birthdate = EvaluationContextMember.Profile.Subject.Date.Value;
                    DateTime referenceDate = DateTime.Now;

                    int age = referenceDate.Year - birthdate.Year;
                    if (birthdate > referenceDate.AddYears(-age))
                    {
                        age--;
                    }

                    ProfilePropertyDto dto = new ProfilePropertyDto
                    {
                        Name = AppResources.Age,
                        Value = age
                    };
                    properties.Insert(0, dto);
                }

                if (EvaluationContextMember.Profile.Position.IsNotEmpty())
                {
                    ProfilePropertyDto dto = new ProfilePropertyDto
                    {
                        Name = AppResources.Position,
                        Value = EvaluationContextMember.Profile.Position
                    };
                    properties.Insert(0, dto);
                }

                return properties;
            }
        }

        public bool HasProperties { get { return Properties.IsNotEmpty(); } }

        public bool ShowProperties { get; set; }
        #endregion

        public ICommand ExpandCollapseClickCommand { get; set; }

        public Action<EvaluationContextMemberCell> IsShowPropertiesChangedAction { get; set; }

        public EvaluationContextMemberCell()
        {
            ExpandCollapseClickCommand = new Command((obj) => {
                ShowProperties = !ShowProperties;
                OnPropertyChanged("ShowProperties");
                OnPropertyChanged("ShowPosition");
                IsShowPropertiesChangedAction.Invoke(this);
            });
        }

        protected void OnPropertyChanged(string name)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
        }
    }

How to implement In-App Purchase in Xamarin.Forms

$
0
0

I searched but couldn't find correct implementation. Please help.

Thanks

Drag and Drop List Recommendations

$
0
0

Hi All,

I've spent the last few days trying to get SyncFusions SfListView working in an application I'm working on. I think I've finally come to the end of the road with it. Buggy and weird behaviours, orr architecture, crashes and terrible documentation and samples have just about used up my determination to persevere with it.

Can anyone here recommend alternatives that I should check out?

It seems there is precious little out there about doing drag and drop things with Xamarin Forms or am I just Googling wrong? LOL.

Obviously one alternative is to build it all but that is most likely going to more error prone and expensive that buying a decent component.

Any pointers to controls or examples of building would be really appreciated.

Thanks,

J

Drag and Drop Recommendations

$
0
0

Hi All,

I've spent the last few days trying to get SyncFusions SfListView working in an application I'm working on. I think I've finally come to the end of the road with it. Buggy and weird behaviours, orr architecture, crashes and terrible documentation and samples have just about used up my determination to persevere with it.

Can anyone here recommend alternatives that I should check out?

It seems there is precious little out there about doing drag and drop things with Xamarin Forms or am I just Googling wrong? LOL.

Obviously one alternative is to build it all but that is most likely going to more error prone and expensive that buying a decent component.

Any pointers to controls or examples of building would be really appreciated.

Thanks,

J

Drag and Drop Recommendations

$
0
0

Hi All,

I've spent the last few days trying to get SyncFusions SfListView working in an application I'm working on. I think I've finally come to the end of the road with it. Buggy and weird behaviours, odd architecture, crashes and terrible documentation and samples have just about used up my determination to persevere with it.

Can anyone here recommend alternatives that I should check out?

It seems there is precious little out there about doing drag and drop things with Xamarin Forms or am I just Googling wrong? LOL.

Obviously one alternative is to build it all but that is most likely going to more error prone and expensive that buying a decent component.

Any pointers to controls or examples of building would be really appreciated.

Thanks,

J


This project references NuGet package(s) that are missing on this computer

$
0
0

Severity Code Description Project File Line Suppression State
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ....\packages\Xamarin.Android.Support.Annotations.26.0.2\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets

Need to refresh calling ContentPage when called ContentPage is finished

$
0
0

OK, so this is an MVVM project.

I have a ContentPage (StudentListPage with StudentListViewModel) that presents a list of passing students. When a student is tapped (his name is Charlie) we go to another ContentPage, called StudentDetailPage with StudentDetailViewModel. We change the Charlie's status from passing to failing, save the record, then hit the android back button.

How does the StudentListViewModel get informed that StudentDetailViewModel updated Charlie's status, and that we should now refresh the list?

I could probably do this with some sort of kludgey code-behind madness, but I want to avoid gyrations. I'm looking for something quick, clean, correct and understandable. The best thing I've come up with so far, is to have the Detail VM send to a MessageCenter, and have the List VM subscribe to it and refresh when it detects an "i-just-saved" message from the Detail VM.

Dialog ContentPage Animate from Top and Overlay on Button (Only On Button Click)

$
0
0

Dialog ContentPage Animate from Top and Overlay on Button (Only On Button Click)

  1. I need in Prism, Dialog ContentPage is also Ready , Only thing is need to call and Animate.

  2. Need to Change the Month in Calender.

Problems implementing Camera Preview

Change color of button image-source

$
0
0

Hello, I need to change the color from an imagesource of a button. I found this plugin: https://github.com/shrutinambiar/xamarin-forms-tinted-image but the first problem is that its outdated and doesn't work on android. The second problem is that I need to change the color of a button imagesource and not of an image. I tried to create an image and use it as imagesource but this didn't work. Is there any solution to change the color of an imagesource of a button? Thanks in advance.

Viewing all 89864 articles
Browse latest View live


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