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

iOS page covers status bar

$
0
0

What should I do to prevent the application cover the status bar area?
It covers the whole window and status icons are visible through top_grid on iPad 2 simulator


<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                       x:Class="test_cs_mobile_xamarin.main_page">
   <StackLayout>
      <Frame x:Name="top_frame" HasShadow="true" OutlineColor="Green" Padding="5,5,5,5" VerticalOptions = "FillAndExpand">
         <ScrollView  x:Name="top_scroll_view" VerticalOptions = "FillAndExpand">
            <Grid x:Name="top_grid" VerticalOptions = "FillAndExpand">
               <Grid.Children>
               </Grid.Children>
            </Grid>
         </ScrollView>
      </Frame>
      <Frame x:Name="bottom_frame" HasShadow="true" OutlineColor="Green" Padding="5,5,5,5" VerticalOptions = "FillAndExpand">
         <ScrollView x:Name="bottom_scroll_view" VerticalOptions = "FillAndExpand">
            <Label  Text="..." XAlign="Start" YAlign="Start" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" x:Name="bottom_label" LineBreakMode="WordWrap" />
         </ScrollView>
      </Frame>
      <StackLayout x:Name="bottom_stack_layout" Orientation="Horizontal">
         <Button Text="Add 1" x:Name="button_1"></Button>
         <Button Text="Add 2" x:Name="button_2"></Button>
         <Button Text="http" x:Name="button_3"></Button>
         <Button Text="http 1" x:Name="button_4"></Button>
      </StackLayout>
   </StackLayout>


No auto generated events from .xaml file in .xaml.cs file

$
0
0

Hello everyone,

I have a test.xaml file and his corresponding test.xaml.cs file in my common xamarin project.
When I add a "Clicked='MyHandler'" option on a tag in my test.xaml file, VS doesn't generate the code for the event in test.xaml.cs file...

I'm really stuck with this issue...


The reference assemblies for framework “Xamarin.iOS,Version=v4.6.1” were not found

$
0
0

what is the source of this error?

The reference assemblies for framework "Xamarin.iOS,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

Xamarin.Forms CardsView nuget package

$
0
0

Hi all) I've released new package for Xamarin.Forms (Something like Tinder's CardsView)
Maybe, someone will be interested in it

nuget.org/packages/CardsView/ -- nuget
github.com/AndreiMisiukevich/CardView -- source and samples

Pass listItem data using command from button in MVVM

$
0
0

I am working on an app that will allow the user to pay for a Utility Bill. It allows for multiple utility accounts to be linked to one user. I have a list view that properly displays the information, in each ListItem Template i need to pass the value from the label to the ViewModel using a button. If this is ansered else where please let me know, i have searched for days and nothing so far has worked.

Here is my View:

<ContentPage.BindingContext>
        <local:UtilityViewModel/>
    </ContentPage.BindingContext>
    <StackLayout>
        <ListView x:Name="UtilityAccts"
            ItemsSource="{Binding Items}"
            HasUnevenRows="true"
                  SelectedItem="{Binding SelectedItem}"
            SeparatorVisibility="Default"
            SeparatorColor="#0b4996"
            CachingStrategy="RecycleElement">
            <!--Built in Cells-->
            <!--<ListView.ItemTemplate>
        <DataTemplate>
                <TextCell Text="{Binding UtilAcctNum}" />
            </DataTemplate>
    </ListView.ItemTemplate>-->
            <!--Custom View Cells-->
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout>
                            <Grid Padding="10">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto"/>
                                    <RowDefinition Height="45"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Label Text="{Binding UtilAcctNum, StringFormat='Account#: {0}'}" Style="{DynamicResource ListItemTextStyle}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" HorizontalTextAlignment="Start" TextColor="Default" />
                                <Label Text="{Binding AmountStr, StringFormat='Amount: ${0:C}'}" Style="{DynamicResource ListItemDetailTextStyle}" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" HorizontalTextAlignment="End" TextColor="{Binding DueColor}"/>
                                <Button Text="Pay $" BackgroundColor="Green" TextColor="White" Grid.Row="1" Grid.Column="0" BorderRadius="4" BorderColor="YellowGreen" BorderWidth="2" Command="{Binding LoadPay}"/>
                                <Button Text="Remove -" BackgroundColor="Gray" TextColor="White" Grid.Row="1" Grid.Column="2" BorderRadius="4" BorderColor="LightGray" BorderWidth="2" Command="{Binding Remove}"/>
                                <Button Text="History"  BackgroundColor="Green" TextColor="White" Grid.Row="1" Grid.Column="1" BorderRadius="4" BorderColor="YellowGreen" BorderWidth="2" CommandParameter="{Binding UtilAcctNum}" Command="{Binding LoadHistory}"/>
                            </Grid>
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <Button Text="Add +" BackgroundColor="Green" TextColor="White" BorderRadius="4" BorderColor="YellowGreen" BorderWidth="2" Command="{Binding AddUtilAcct}"/>
    </StackLayout>

and here is my View Model (some info redacted)

public class UtilityViewModel : INotifyPropertyChanged
    {
        #region UtilityList
        public event PropertyChangedEventHandler PropertyChanged;
        private ObservableCollection<MobileUtilityAccountView> _items = new ObservableCollection<MobileUtilityAccountView>();
        public ObservableCollection<MobileUtilityAccountView> AccountList = new ObservableCollection<MobileUtilityAccountView>();
        private MobileUtilityAccountView _selectedItem;

        public Command LoadPay { get; }
        public Command LoadHistory { get; set; }
        public Command Remove { get; }
        public Command AddUtilAcct { get; }

        public ObservableCollection<MobileUtilityAccountView> Items
        {
            get
            {
                return _items;
            }
            set
            {
                _items = value;
                OnPropertyChanged("Items");
            }
        }

        public MobileUtilityAccountView SelectedItem
        {
            get
            {
                return _selectedItem;
            }
            set
            {
                _selectedItem = value;
                if(_selectedItem == null)
                {
                    return;
                }
                else
                {
                    OnPropertyChanged("SelectedItem");
                }

                SelectedItem = null;

            }
        }

        public UtilityViewModel()
        {
            GetAcctNumbers();

            LoadHistory = new Command(HistoryCmd);
        }

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

        private async void GetAcctNumbers()
        {
            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Verified.txt");
            var fileContent = File.ReadAllText(path).Split('|');
            string ID = fileContent[0].Replace("\"", "");
            HttpResponseMessage response = new HttpResponseMessage();
            HttpClient client = new HttpClient();
            Uri uri = new Uri("******************);
            response = await client.GetAsync(uri);
            if(response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();
                Items = JsonConvert.DeserializeObject<ObservableCollection<MobileUtilityAccountView>>(content);

                for (var i = 0; i < Items.Count(); i++)
                {
                    if (Items[i].UtilAcctAmtDute > 0)
                    {
                        Items[i].AmountStr = Items[i].UtilAcctAmtDute.ToString();
                        Items[i].DueColor = "#cc0000";
                    }
                    else if (Items[i].UtilAcctAmtDute < 0)
                    {
                        Items[i].AmountStr = Items[i].UtilAcctAmtDute.ToString().Replace("-", "") + " CR";
                        Items[i].DueColor = "#00cc00";
                    }
                    else
                    {
                        Items[i].AmountStr = Items[i].UtilAcctAmtDute.ToString();
                        Items[i].DueColor = "#00cc00";
                    }
                }
            }
        }

        private void HistoryCmd(Object obj)
        {
            LoadHistoryPage(obj.ToString());
        }

        private async void LoadHistoryPage(string utilAcctNum)
        {
            var page = new NavigationPage(new UtilityAccountDetailsPage(utilAcctNum));
            NavigationPage.SetHasNavigationBar(page, true);
            NavigationPage.SetBackButtonTitle(page, "Back");
            page.Title = "";
            await App.Current.MainPage.Navigation.PushAsync(page, true);
        }
        #endregion
    }

Here is a screenshot of the emulated View:

The "ConvertResourcesCases" task failed unexpectedly. System.IO.IOException: The process cannot acc

$
0
0

Hi,
Can anyone help me in finding a solution for the following error????? i tried deleting Bin, obj and rebuilding project , renaming the project but still i'm facing the issue. please help me!!

Severity Code Description Project File Line Suppression State
Error The "ConvertResourcesCases" task failed unexpectedly.
System.IO.IOException: The process cannot access the file 'C:\Users\300092\AppData\Local\Temp\tmp9C27.tmp.bk' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at Monodroid.AndroidResource.UpdateXmlResource(String res, String filename, Dictionary2 acwMap, IEnumerable1 additionalDirectories)
at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources(ITaskItem item, Dictionary2 acwMap) at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources(Dictionary2 acwMap)
at Xamarin.Android.Tasks.ConvertResourcesCases.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() EBUTOR_LP.Android

[HELP] Hi, guys!. I need to create a vertical listview.

$
0
0

Hi, guys!. I need to create a vertical listview with 3 options like this image! but how?
ht7ps://us.v-cdn.net/5019960/uploads/editor/6g/a1f4qyomnm1a.png Change 7 in the link for t

Is there any plugin for crossplatform that i can use as a file Upload control

$
0
0

I am working on Xamarin forms app and i have page for creating tasks for employees and i need to add funtionality to upload image and files via file upload / camera for each task( For example if the task has an accompaning word document /image) . But in Xamrin form i come seem to see any control that acts as a file uploader.. I them need to post those files to the server.


Auto fill the otp.

$
0
0

Hi Everyone,
I want to implement the functionality of Auto Fill the OTP in my app. Like when I get the otp number in the message, my app will detect the otp and will verify it.

Thanks in advance.

Use Device PIN /and/or Fingerprint to authenticate

$
0
0

Hi,

How can I use the device PIN and/or Fingerprint to authenticate in my app so user needs to enter the same device PIN or use his fingerprint if he enabled fingerprint on his device unlock.

Thanks,
Jassim

ListView item selected not working in MvvM

$
0
0

Hi Everyone ,
I am new to xamarin and i am developing an app.
I am working on the listview item tapped navigation in mvvm where when user taps on the list item it will navigate to the detail page of the tapped item.
Following is my code for design

      <ListView HasUnevenRows="True" x:Name="list" 
                SelectedItem="{Binding MySelectedItem}" ItemsSource="{Binding UserTrailList}" >

               <ListView.ItemTemplate >
              <DataTemplate> 
             <ViewCell>
                  <ViewCell.ContextActions>
                    // my detail desing here
                  </ViewCell.ContextActions>

      </ListView>

Following is ViewModel code

     private readonly IWebService _webService;
      private readonly IMvxNavigationService _navigationService;
       public UserTrailModel _ItemSelected;
      private OfflineService _offlineService;
     private ObservableCollection<UserTrailModel> _userTrailList;
     string trailId="";


    private UserTrailModel _mySelectedItem { get; set; }

      public UserTrailModel MySelectedItem
     {

        get { return _ItemSelected; }
        set
        {

            if (_mySelectedItem != null)
            {
                _navigationService.Navigate<TrackingTourDetailsViewModel>();
            }
        }
    }



    public OfflineService OfflineService
    {
        get => _offlineService ?? (_offlineService = new OfflineService(FormsApp.PeakRLocalDBContext.SQLiteDBConnection));
        set
        {
            _offlineService = value;
            RaisePropertyChanged(() => OfflineService);
        }
    }

    public ObservableCollection<UserTrailModel> UserTrailList
    {
        get => _userTrailList ?? (_userTrailList = new ObservableCollection<UserTrailModel>());
        set
        {
            _userTrailList = value;
            RaisePropertyChanged(() => UserTrailList);


        }
    }

Please help me find the solution or is there anything wrong in may code .

How to show page number while scrolling a list in xamarin forms?

$
0
0

I have a listview with 2005 items,and it has a lazy loading.On itemAppearing I am loading 50 items at a time.I want to show a page number while user scroll up or scroll down depends on current items on the display.

Example: Listview loads 150 items(50 items each Lazy loading) when I am scrolling and reached to 130 index of listview.At this time I want to show the page number 3.Because 130 listview index is under 100-150.

how to implement this?

Alarms in Xamarin.Forms

$
0
0

I am creating an app where I need users to set alarms. How can I do this without having to customize the code for each platform? If this can't be done, then how exactly do I enable the alarm functionality? so far, I have only been able to find examples for xamarin android.

How to add multiple init codes at a time in App.xaml.cs for UWP?

$
0
0

I have init codes of both circle image and pop up image in App.xaml.cs. Only the first code is working, the code after Xamarin.Forms.Forms.Init is not working. My current code is adding below:

       //ImageCircle
       var rendererAssemblies = new[]
        {
            typeof(ImageCircleRenderer).GetTypeInfo().Assembly
        };
        Xamarin.Forms.Forms.Init(e, rendererAssemblies);
        //Popup
        Rg.Plugins.Popup.Popup.Init();
        Xamarin.Forms.Forms.Init(e, Rg.Plugins.Popup.Popup.GetExtraAssemblies());

Now image circle is working and pop up image is not working, how to add multiple init codes at a time?

Thanks in advance.

Implementation of Spinner

$
0
0

Is it possible to implement the Spinner in Xamarin.Forms using Custom renderer or any other concept.

Thanks in advance.


How to release and reacquire the camera resource with zxing

$
0
0

I am creating a light-weight scan application using xamarin forms, prism and zxing.

The application will continue to scan and analyse when the phone is locked (only on Andriod). This seems to be a problem for both zxing 2.3.1 and 2.4.1.
Wen the phone is locked, the application seemingly dont care that IsAnalysing = false.

How can i release and reacquire the camera resource in the App.xaml.cs file using OnSleep() and OnResume()?

Xam.Plugin.Connectivity - How to find out networks 4g, 3g, LTE, Edge networks from plugin

$
0
0

Hi,

Anyone knows How to find out networks 4g, 3g, LTE, Edge networks from Xam.Plugin.Connectivity

Can I show second time api fetched data in the same page where I showed first time api fetched data?

$
0
0

I have created a page , mypage.xaml. On that page I have created a button, on which if I click It will open a popup page.
In the popup page entry field it's accepting some value as parameter and calling web service.And the web service is returning list to the popuppage.xaml.cs page. I configured the code to send the list from popup.xaml.cs to mypage.xaml.cs page.

But Every time I have to create new instance of mypage to send the list. And when new instance is created then the back button at top left corner is showing.I don't want to create new instance of mypage every time of call services.
Is is possible in xamarin to send the data from one page to another without creating instance everytime of that 'accept page'?

share data between views in carouselview

$
0
0

Hello everyone!, somebody knows how can I share an object or a variable between views in a carouselview page that receive a parameter from another page?

thanks in advance!

How to decrease size of apk in Xamarin forms.

$
0
0

This is my first try at release app. I am registering and logging in app via Web Api. I have a live website and have written Api Service for that. It is working fine and then i released the apk. Firstly it was of 55.5 MB then after tinkering a little bit i came up to 15 MB.
But i think that 15 MB is too large for an app that has minimal functionality.
Currently my settings are-
Generate one package - checked
Enable progurad - checked
Linking- SDK and user assemblies.

I would like to bring down the size more . Please anybody have any suggestions.

PS: Forgive if i sound naive i am new to xamarin and trying to learn it.

Viewing all 77050 articles
Browse latest View live


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