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

找@微859, 2229快速优惠购买多伦多大学毕业,证/文,凭毕业,证/成绩单@微859, 2229文,凭 它国请详询859, 2229

$
0
0

@微859, 2229快速优惠购买西安大略大学毕业,证/文,凭毕业,证/成绩单@微859, 2229文,凭 它国请详询859, 2229


找@微859, 2229快速优惠购买卡尔顿大学毕业,证/文,凭毕业,证/成绩单@微859, 2229文,凭 它国请详询859, 2229

$
0
0

@微859, 2229快速优惠购买卡尔顿大学毕业,证/文,凭毕业,证/成绩单@微859, 2229文,凭 它国请详询859, 2229

BackgroundImage when using MasterDetailPage

$
0
0

Hello Guys!

I have a ContentPage, such like this:

ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="XXXXXX"
Title="Title"
BackgroundImage="bg_app.png"
Padding="5"

When I use that page directly in App.Current.MainPage the BackgroundImage appears... But, when I use the same page in MasterDetailPage.Detail, the background image don't works...

When I set MasterDetailPage.BackgroundImage property... The BackgroundImage don't work too.

Any sugestions?

How to open a view in a parent from another view?

$
0
0

Hi,

From my HomePage (ContentPage) which is the parent I am opening the AboutMerchant (ContentView) this way:

var view = new AboutMerchant();
view.GetMerchantProfile();

DynamicPageView.Children.Clear();
DynamicPageView.Children.Add(view);

Now from the AboutMerchant, I want to open MySetting (ContentView) as a view in the HomePage parent as well so it's kind of redirect.

How can I do that please?

Thanks,
Jassim

Update Parent's control from View

$
0
0

Hi,

I have HomePage (ContentPage) and from there I am opening AboutMerchant (ContentView this way:

var view = new AboutMerchant();
view.GetMerchantProfile();

DynamicPageView.Children.Clear();
DynamicPageView.Children.Add(view);

On HomePage I have a LabelTitle..

From the AboutMerchant ContentView, how can i change the LabelTitle located on parent, something like this:

[PARENT].LabelTitle.Text = "About";

Thanks,
Jassim

Using IServiceProvider in .net standard can't be done?

$
0
0

I am trying to use .net standard instead of PCL since Microsoft is forcing us to.

To resolve IServiceProvider not working I had to install system.ComponentModel v4.3.0

Installing system.ComponentModel v4.3.0 broke everything... had to uninstall it. Now I can run my app without error as long as I don't try to embed images.

Has anyone found a resolution to this?

I can't use embedded images in a .net standard without IServiceProvider and since Microsoft is killing off PCL we HAVE to move to .net standard.

Any ideas anyone?

ToolbarItems throws Cannot implicitly convert type 'System.Threading.Tasks.Task' to 'bool'

$
0
0

Hi,

I am trying to use below code to show a Signout toolbar button which works fine

but when I add a DisplayAlert to it I get:

Error CS0029: Cannot implicitly convert type 'System.Threading.Tasks.Task' to 'bool' (CS0029)

Here is the code:

ToolbarItems.Add(new ToolbarItem("Sign Out", null, () =>
{
    var answer = DisplayAlert("Sign Out", "Would you like to sign out now?", "Yes", "No");

    if (answer)
    {
        Application.Current.Properties.Clear();
        Navigation.PushModalAsync(new NavigationPage(new ZeeraSignin()));
    }
}));

How can I fix this please..

Thanks,
Jassim

ListView.SelectedItem won't work in UWP

$
0
0

I have a MasterDetailPage and in my constructor I have the following code to add menu items in a ListView. But the last row, selecting the first item in the ListView so you can see that it is selected as default, only works in iOS and Android, not in UWP. Clicking an item in the menu/ListView will mark the item selected.
Is this an known issue or do I have to do something else?

var masterPageItems = new List<MenuPageItem>();  
masterPageItems.Add(new MenuPageItem  
{  
    Title = "Counter",  
    IconSource = "countericon.png",  
    TargetType = typeof(Counter_Page)  
});  
masterPageItems.Add(new MenuPageItem  
{  
    Title = "Ranks",  
    IconSource = "ranksicon.png",  
    TargetType = typeof(Ranks_Page)  
});  
ListView.SelectedItem = masterPageItems[0];  

Add Windows plotform on existing solution

$
0
0

Hi to all,
I want to add windows platform to an existing solution (Android and IOS).
Where can I find any information (if exists)

Thanks in advance

Was PCL removed ?!

$
0
0

Hello, Xamarin Community !
I was above to create a cross platform project in Visual Studio 2017 Community but there wasn't any PCL feature.

Was it removed or just renamed. Please help me find out !

Thanks for answers !!!

Alarm Manager doesn't work with Android API 25

$
0
0

Hi. I have a problem with Alarm Manager that doesn't fired my schedule notification.
using Android.App;
using Android.Content;
using GNote.Android;
using GNote.Droid;
using GNote.Converters;
using System.Collections.Generic;
using Xamarin.Forms;
using GNote.Droid.Models;
using Android.OS;
using GNote.Res.SQLite;
using Android.Icu.Util;
using System;
using GNote.Models;

[assembly: Dependency(typeof(MyNotification))]
namespace GNote.Droid
{
    class MyNotification : INotification
    {
       private List<Note> ListNotes;
       Intent alarmIntent;
       DateTime baseTime = new DateTime(1970, 1, 1);

        public async void CreateScheduleNotifications()
       {
            ListNotes = await DataBaseService.getTimeActiveNotes();
           foreach(Note note in ListNotes )
            {
                long scheduleAlarmTime = this.setScheduleAlarmTime(note.AlarmTime);

                this.addNewScheduleNotification(note.Id,note.Title,note.Content,scheduleAlarmTime);
            }
        }

        private void addNewScheduleNotification(int id,string title, string content,long alarmTime)
        {
           alarmIntent = new Intent(MainActivity.AndroidContext, typeof(AlamReciver));

            alarmIntent.PutExtra("id", id);
            alarmIntent.PutExtra("title", title);
            alarmIntent.PutExtra("content", content);

            var PI = PendingIntent.GetBroadcast(MainActivity.AndroidContext, id, alarmIntent, PendingIntentFlags.CancelCurrent);                
            AlarmManager alarmManager = (AlarmManager)MainActivity.AndroidContext.GetSystemService(Context.AlarmService);
            alarmManager.Set(AlarmType.RtcWakeup, alarmTime, PI);
        }

        private long setScheduleAlarmTime(DateTime noteAlarmTime)
        {
            TimeSpan calcTime = noteAlarmTime - baseTime;
            return (long)calcTime.TotalMilliseconds;
        }
    }
}

My "noteAlarmTime" format is (y,m,d,h,m,s).

It works perfect on emulator with API 23 but when I launch app on API 25 then nothing happen.
During testing I noticed something is wrong with this line:

alarmManager.Set(AlarmType.RtcWakeup, alarmTime, PI);

When I change it to:

alarmManager.Set(AlarmType.ElapsedRealtime, SystemClock.ElapsedRealtime() + 5 * 1000, PI);
then notification was displayed.

So, is my time calculation is wrong? Or is different time system between API 23 and 25.

Or problem is somewhere else.

Thank you.

DataAnnotation supprt with INotifyDataErrorInfo

$
0
0

I came from WPF background, and according to the similarities between XF and WPF in terms of MVVM, Data Binding, INPC.. etc,
I found that I can't use data annotations in System.ComponentModel.DataAnnotations such as EmailAddress, Required and so on.. so what is the alternative approach to mark a property as Required or as EmailAddress, if I could benefit from INotifyDataErrorInfo?

Few questions about databases

$
0
0

Hi
I'm doing a simple app which have to display text and pictures.
I want to store this pictures and text in a online database (so it can be updated easily), but the app should read from a local database. So this local db should fetch from the online one when there is changes. But there is few things i don't understand because of my low dev skills.

  1. Should i store pictures directly in the db? I know it's not the best solution, but there won't be a lot of pictures and not big sized. If not, how to do then?

  2. How can i handle all this online db / local db / app cycle? If there is existing samples it will be welcome.
    Im my mind it works like: at launching of the app, a webservice is used to fill the local db from online db if content have changed, then the app display content from local db. If no changes, no fetching from online db.

  3. Online db = Mysql, local db = sqlite?

  4. To store local settings like notifications schedulle, theme selection, should i put them in local db or there is another solution?

But maybe i'm thinking wrong way about how to make it work...

Found some topics about PCLStorage, it may do the trick?

Thanks for your help

Xamarin.Forms Android Entry Focus results in parent view being removed from layout

$
0
0

I'm using absolute layouts throughout our app to present modal pages, many of which contain entrys to retrieve input from the user. On one of these pages specifically - when the entry gains focus the entire modal panel is immediately removed from the layout for some reason. The application output is providing some clues - and I have denoted one of the lines below with an arrow where it looks like its retrieving a null input, but I cannot figure out why this is happening or how to resolve it.

Does anybody here know what I'm doing wrong?

**Application Output: (Note: The FOCUSED and UNFOCUSED text lines are debug print statements that I have inserted for testing.)

[ViewRootImpl@f5a7640[MainActivity]] ViewPostImeInputStage processPointer 0
[ViewRootImpl@f5a7640[MainActivity]] ViewPostImeInputStage processPointer 1

FOCUSED

[InputMethodManager] Starting input: tba=android.view.inputmethod.EditorInfo@958fa09 nm : com.esp.forza ic=com.android.internal.widget.EditableInputConnection@307640e
[InputMethodManager] startInputInner - mService.startInputOrWindowGainedFocus
[InputTransport] Input channel constructed: fd=100
[InputTransport] Input channel destroyed: fd=89
[InputMethodManager] SSI - flag : 0 Pid : 28127 view : com.esp.forza
[ViewRootImpl@f5a7640[MainActivity]] MSG_RESIZED: frame=Rect(0, 0 - 1440, 2960) ci=Rect(0, 0 - 0, 168) vi=Rect(0, 0 - 0, 168) or=1
[ViewRootImpl@f5a7640[MainActivity]] Relayout returned: oldFrame=[0,0][1440,2960] newFrame=[0,0][1440,2960] result=0x1 surface={isValid=true 547406497792} surfaceGenerationChanged=false
[ViewRootImpl@f5a7640[MainActivity]] MSG_RESIZED: frame=Rect(0, 0 - 1440, 2960) ci=Rect(0, 0 - 0, 168) vi=Rect(0, 0 - 0, 1225) or=1
Thread finished: #9
Thread started: #14
[ViewRootImpl@f5a7640[MainActivity]] ViewPostImeInputStage processPointer 0
[ViewRootImpl@f5a7640[MainActivity]] ViewPostImeInputStage processPointer 1
[InputMethodManager] HSIFW - flag : 0 Pid : 28127

UNFOCUSED

--> [InputMethodManager] Starting input: tba=android.view.inputmethod.EditorInfo@a61507d nm : com.esp.forza ic=null
[InputMethodManager] startInputInner - mService.startInputOrWindowGainedFocus
[InputTransport] Input channel constructed: fd=89
[InputTransport] Input channel destroyed: fd=100
[IInputConnectionWrapper] finishComposingText on inactive InputConnection
[IInputConnectionWrapper] finishComposingText on inactive InputConnection
[ViewRootImpl@f5a7640[MainActivity]] MSG_RESIZED: frame=Rect(0, 0 - 1440, 2960) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
[ViewRootImpl@f5a7640[MainActivity]] Relayout returned: oldFrame=[0,0][1440,2960] newFrame=[0,0][1440,2960] result=0x1 surface={isValid=true 547406497792} surfaceGenerationChanged=false
Thread finished: #26
Thread started: #29**

Highlight specific locality/state from an address

$
0
0

Hey! currently Im getting a position from an address (Example: the user put Manhattan and i get te latitude and longitude of the center of manhattan). So far so good .. but now I want to highlight all manhattan area, but I dont know how to do it automatically, without hardcode. I am using Xamarin.Maps and Plugin.Geolocator. Also, for the polygons i used the "Highlighting a Region on a Map" guide from xamarin doc. I want to highlight all manhattan area without hardcoding the shapeCoordinates, as google maps do.

Thank You!


Picker not showing value

$
0
0

I need to set a value to picker but it seems to not work in two way:

<Picker ItemsSource="{Binding myModelList}" 
        SelectedItem="{Binding myModel, Mode=TwoWay}" />

ViewModel:

public class TestViewModel : ObservableProperty
{
    public List<MyModel> myModelList { get; set; }
    private List<MyModel> _myModel;
    public List<MyModel> myModel;
    {
        get
        {
            return _myModel;
        }
        set
        {
            _myModel = value;
            OnPropertyChanged("myModel");
        }
    }

    async public Task prepareModels()
    {
        myModelList = await DB.query<MyModel>("SELECT * FROM MyModel;");
    }

    async public Task loadModel(int modelId)
    {
        myModel= await DB.getById<MyModel>(modelId);
    }

}

After call load model not is showing in picker. I created a button to show the selectedItem and its have an item selected, but got nothing in UI.
Any help?

iOS Background image scale

$
0
0

Hi,

I noticed many people have the problem of the background image of a forms page not scaling in iOS. I solved it with this code:

[assembly: ExportRenderer(typeof(InfoPage), typeof(InfoPage_iOS))]

namespace Oxaco_BBC.iOS
{
    public class InfoPage_iOS : PageRenderer
    {
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(false);

            UIGraphics.BeginImageContext(this.View.Frame.Size);
            UIImage i = UIImage.FromFile("Background.png");
            i = i.Scale(this.View.Frame.Size);

            this.View.BackgroundColor = UIColor.FromPatternImage(i);

        }
    }
}

Picker doesn't show selected item in list

$
0
0

Hi,

I have a simple test picker like this:

<StackLayout> <Picker SelectedIndex="0" > <Picker.Items> <x:String>Option A</x:String> <x:String>Option B</x:String> </Picker.Items> </Picker> </StackLayout>

If I select an item, and after that reopen the picker, then the currently selected item is indicated by a top and bottom line surrounding the selected item. That works in iOS.

In Android however this doesn't seem to work, although to the screen prints in the documentation it should also work the same way like in iOS. What am I doing wrong here?


Image binding using path in Xamarin forms

$
0
0

Hi All,

This is how I am trying to bind image in ListView-

fruitGroup.Add (new MenuListModel () {
Name_PriceTag = "strawberry", IsReallyAVeggie = false,Comment = "spring plant",item_Image="fruit_salad.jpeg"
});

and Xaml -

  <Image Source="{Binding item_Image}"/>

In above example, item_Image is a type of string. I am working on xamarin forms with Mac using Xamarin studio. I am not able to access "fruit_salad.jpeg" which stored in Image folder of PCL project. Instead of using file name, if I am using URL of any image, it's accessible. What to do for accessing images stored in Images folder of PCL project.

how to find this image by type in android custom renderer?

$
0
0
        <Grid ><Image x:Name="trashBoxImage" Grid.Column="1" /></Grid>

in other words to what Android type the xaml image will be mapped to?
exp: if(view is ????class????? ) then ..

Viewing all 58056 articles
Browse latest View live


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