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

Editor with Autosize=TextChanges inside scrollview inside grid, not ok on iOS

$
0
0

Make this the content of a normal content page:

<Grid>
   <Grid.RowDefinitions>
      <RowDefinition Height="*"/>
      <RowDefinition Height="200"/> 
   </Grid.RowDefinitions>
   <ScrollView Grid.Row="0">
         <Editor AutoSize="TextChanges"/>
   </ScrollView>
   <Label Grid.Row="1" Text="Random text" VerticalOptions="FillAndExpand" BackgroundColor="Blue"/>
</Grid>

Now, on iOS if you write more then can fit on the screen, the expected behaviour would be for the scroll view to scroll down, so you could Always see what you are typing. This is also how it works on Android. However, on iOS the scrolling doesn't work, so you cant see what you are typing without manually doing the scroll.

Must be a bug, I guess?
Is this a known issue?


Why am I unable to add more children?

$
0
0

Hello everyone,

I am currently making a page to edit a contact. As of now I am making test code to create the functionality before moving to my main app.
On the edit contact page there should be an option to add a field (such as add an extra phone number) due to the fact some of the contacts may have more than one phone, email, address, etc..

The problem I am experiencing is that when I hit a button to dynamically add a field, it only adds one child maximum instead of adding as much as the user would like.

Here is my .xaml code:
<ContentPage.Content> <StackLayout x:Name="Panel"> <Button Text="Add Field" Clicked="AddField"/> <Button Text="Remove Field" Clicked="RemoveField"/> <Entry x:name="newEntry" Placeholder="Origin"/> </StackLayout> </ContentPage.Content> </ContentPage>

Here is my .cs code

namespace Test
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class p2 : ContentPage
    {
        Entry newEntry = new Entry();
        public p2()
        {
            InitializeComponent();
        }
        void AddField(object sender, EventArgs e)
        {
            Panel.Children.Add(newEntry);
        }
        void RemoveField(object sender, EventArgs e)
        {
            Panel.Children.Remove(newEntry);
        }
    }
}

I have tried using Panel.Children.Add(new Entry()); however when I used this method I was unable to find the line of code required to remove it.

Thanks in advance for any pointers.

blank xamarin Forms Application build gives 9 errors

$
0
0

I am using visual studio 2015, with Xamarin forms Android version 2.4.0.280. Target Framework and Target Android Version are set to Androide 6.0. JDK, Android SDK, NDK locations are properly set.
It gives following 9 errors when the blank xamarin Forms Application is build.
Error No resource found that matches the given name: attr 'windowActionBar'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 2
Error No resource found that matches the given name: attr 'colorPrimary'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 2
Error No resource found that matches the given name: attr 'colorPrimaryDark'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 2
Error No resource found that matches the given name: attr 'windowNoTitle'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 2
Error Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 2
Error No resource found that matches the given name: attr 'colorAccent'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 3
Error No resource found that matches the given name: attr 'colorAccent'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 4
Error No resource found that matches the given name: attr 'windowActionModeOverlay'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 4
Error Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. App5.Android c:\users\abhiram behera\documents\visual studio 2015\Projects\App5\App5\App5.Android\Resources\values\styles.xml 4
Please tell me what may be possible errors in setting configuration?

Page lifecycle and displaying controls programatically

$
0
0

I have a simple PRISM MVVM project where I am using some Syncfusion controls, specifically a busy indicator, from the ViewModel. My project seems to work fine when I execute the BusyIndicator after launching the app and navigating into a page - I am essentially trying to use this BusyIndicator as a page loading message for time-consuming API calls etc.

The attached demo app works if I start the mainpage and then navigate into the PageB where the BusyIndicator is supposed to be displayed. However, the project crashes when the app starts in PageB. I believe this is something to do with the page lifecycle, I may be trying to present a control from the ViewModel to a non-initiated page possibly.

My question is how do I either figure out when the page is loaded (I am executing the BusyIndicator in the OnNavigatedTo method) and only then start my busyindicator, or if I am doing something completely wrong?

To simulate this, in the app.xaml.cs, please comment the MainPage navigation, and uncomment the PageB navigation. (for the error, there has to be other SF components in the XAML page, in this case I attached an Accordion)

//If you start here, and then click the Button to Page B this works
await NavigationService.NavigateAsync("NavigationPage/MainPage");

//If you start here, you will see a failure
//await NavigationService.NavigateAsync("NavigationPage/PageB");

Icons not appearing on tabbed view

$
0
0

Hi,

I've set up a tabbed page with icons however only the title appears on each tab.

I have checked and the build action is set to AndroidResource.

Any Idea what could be causing the images to not display?

Thanks

How to keep copy-paste and scroll for editor inside scrollview (Xamarin Forms for Android)?

$
0
0

Hi everyone,

I am struggling with Editor for Android, using Xamarin.Forms v3.1.0.697729. If I test with editor as single item inside a stack layout (without scrollview), it is possible to both do a copy and paste of the text, and scroll. After adding scrollview, the scroll inside editor stops working, but copy-paste still works. To fix that, I implemented a custom renderer for Android with DroidTouchListener, as suggested in topic "Editor inside Scrollview not scrolling" from this forum. Now scrolling is working, and long-press to paste is working, but not long-press to copy text. So it seems that I have to choose between having fully functional copy-paste, or to have only paste but with functional scroll.

Does anyone have a workaround for this issue?

UWP - Cannot resolve Assembly or Windows Metadata file

$
0
0

Hi All,

Everything was rolling along smoothly until a few days ago when UWP all of a sudden stopped building after pulling a new version from VSTS (git) with the errors:

  • Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: X.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.'
  • Could not copy the file "obj\x86\Debug\MainPage.xbf" because it was not found.
  • Could not copy the file "obj\x86\Debug\App.xbf" because it was not found.
  • Could not copy the file "obj\x86\Debug\X.Mobile.UWP.xr.xml" because it was not found.

I have a solution structure of the following:

  • X.Core (.NET Standard class library)
  • X.Mobile (.NET Standard PCL)
  • X.Mobile.UWP (UWP specific project)

UWP references Mobile, and Mobile references Core (Core is also referenced by a web API project).

The commit that I pulled from source control did not have any changes to the X.Mobile.UWP .csproj file.

Things I have tried:

  1. The obligatory clean and rebuild.
  2. Delete all obj and bin folders for the entire solution.
  3. Remove and re-add all references in the .UWP project.
  4. Upgrade Xamarin.Forms to the latest stable (3.1.0.637273).
  5. Remove and re-add X.Core reference in the X.Mobile project.
  6. Delete C:\Users\%username%.nuget folder.
  7. Update Microsoft.NETCore.UniversalWindowsPlatform to the latest stable (6.1.5).
  8. Change the target version to all available versions - we've been running on build 16299 for several months.

And I've been beating my head against this problem on and off for days now. Android and iOS projects build just fine, which is ironic considering UWP has been our most stable platform. Anyone have any insight?

EDIT:
After adding a reference to X.Core to the X.Mobile.UWP project directly, I can compile. This shouldn't be the answer though since the UWP project never directly references the Core project.

Grid and Tap gesture recognizer

$
0
0

I had hoped to attach a tap gesture recognizer directly to a Grid as a whole, but found that it didn't work. What did work was to attach gesture recognizers to each cell in the Grid, or I could add a single transparent overlay with a row span/column span to cover the whole of the Grid, and add a gesture recognizer just to that.

How would you go about deciding which approach performs better. I suspect that this would be a case that is the exception to the suggestion of @TheRealJasonSmith ("AVOID transparency. If you can achieve the same (or close enough) effect with full opacity, do so."), especially as the number of cells in the Grid increases.

I would assume that it's better to have a single gesture recognizer, but am curious how I could figure that out from first principles, other than contriving some tests and measuring.


ETA for Mac OS support

$
0
0

What is ETA for Xamarin Forms support for Mac OS?

ResourceManager in a Converter does not update content

$
0
0

Hi all,

I use a ResourceManager with an indexer in my ViewModels for hot reload translation. As I have an ObservableCollection of strings that is hard-coded in the ViewModel, I want to use a converter to translate this part of my app:

# The view code-behind
public partial class ScoreListPage : ViewPageBase
{
    protected ScoreListViewModel ViewModel { get; } = new ScoreListViewModel();

    public ScoreListPage()
    {
        InitializeComponent();

        this.BindingContext = ViewModel;
        this.Resources.Add("TranslateConverter", new TranslateConverter(ViewModel.ScoreResources));
    }
}

public class TranslateConverter : IValueConverter
{
    public IResourceProvider ResourceProvider { get; private set; }

    public TranslateConverter(IResourceProvider resourceProvider)
    {
        ResourceProvider = resourceProvider;
    }

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return ResourceProvider[value.ToString()];
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return value;
    }
}

# The ViewModel
public class ScoreListViewModel : ViewModelBase
{
    public ObservableCollection<Category> Categories { get; set; }

    public ScoreListViewModel()
    {
        this.Categories = new ObservableCollection<Category>
        {
            new Category ("HeartFailure")
            {
                new Score("PhhfGroup", "PhhfGroup_DisplayName", "PhhfGroup_Detail"),
                new Score("PhhfGroup", "PhhfGroup_DisplayName", "PhhfGroup_Detail")
            },

            new Category ("Rythmology")
            {
                new Score("ChadsVasc", "BMI_DisplayName", "ChadsVasc_Detail"),
                new Score("HasBled", "PhhfGroup_DisplayName", "HasBled_Detail")
            }
        };
    }
}

And the XAML:

<ListView
    ItemsSource="{Binding Categories}"
    GroupDisplayBinding="{Binding Name}"
    IsGroupingEnabled="True">
    <ListView.ItemTemplate>
        <DataTemplate>
            <TextCell Text="{Binding DisplayName, Converter={StaticResource TranslateConverter}}"
                        Detail="{Binding Detail, Converter={StaticResource TranslateConverter}}" />
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

But the translation does not work properly as it needs a restart. Why is this not functional ?

Thanks

Custom DatePicker

$
0
0

Hi guys,

How can I customize datepicker control to make the year picker hidden?
I've googled some but most of them are in Java code. I need codes in CSharp.

Thanks in advance. :)

Inheriting XAML view

$
0
0

Hi.

I have an abstract XAML content view and accompanying code-behind class.
I have two implementations of said class, both with their own XAML and code-behind class.
My intention is to add some additional controls in the deriving XAML implementations. My derived XAML classes look as such:

<?xml version="1.0" encoding="UTF-8"?>
<views:MyBasePage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:views="clr-namespace:Something.Views"
             x:Class="Something.Views.MyDerivedPage"
             Title="Overriding Title">

    <ContentPage.ToolbarItems>
        ... some overriding toolbar items ...
    </ContentPage.ToolbarItems>
</views:MyBasePage >

This compiles and runs just fine, but nothing I have declared in the overriding XAML file seems to happen. The title and the toolbar items stay the same as in the base XAML file. Is this not supported or am I doing something wrong? If it's not supported, how are we supposed to handle reuse of XAML?

Thanks!

Guidance on ObservableCollection and SQLite

$
0
0

Hi

I'm writing an app for a friend who does some charity work. I'm not an experienced Xamarin, c# or .Net developer. And I learn by seeing some working code, breaking it and then understanding what the docs are telling me.

Given that haphazard approach, surprisingly I've got 95% of the app working. But I'm completely stuck on populating an ObservableCollection from SQLite. I'm doing this because of the way they want to represent the data they're recording and the SyncFusion SFChart does what they want.

I can populate the charts using OberservableColections of data hard coded in a class. I can populate ListView's from the SQLite database using LINQ and SQLiteAsyncConnection . For those parts I think I've got a decent understanding of what I'm doing (and I've bought a set of courses from Udemy to learn it properly). However I'm really struggling to populate the Observable Collections the Syncfusion charts need when I try pull the data from SQLite.

After lots of searching and trial and error, I'm coming across both very little in the way of worked examples of ObservableCollections and SQLite. But also comments to other peoples questions on StackExchange effectively saying "it's easy, stop asking basic questions". Which leads me to think that I'm approaching the problem in the wrong way.

All of that pre-amble is effectively me saying I've done lots of research, I've got a lot of the way on my own, and I'm not asking for someone to write my code for me. But I think my lack of knowledge in Xamarin / C# / .NET means I'm trying to solve the problem in the wrong way. So given the same problem, how would you approach it? Just trying to get a feel as to whether I should keep banging my head against this brick wall or I should try a different approach that is obvious to more experienced developers

Thanks

Can i use Parameter value from another function to Button Event?

$
0
0
    namespace Seagull.Views
  {
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class MyPopupPage : PopupPage
   {
      public MyPopupPage(string Pin) //==> I want to use String Pin value use Confirm_Procedure , pass String Pin value to Confirl_Procedure
      {
        InitializeComponent();

       }
      public void Confirm_Procedure(object sender, EventArgs e)
      {
        //==> I want use String pin value to here.

        PopupNavigation.Instance.PopAsync();
       }
     }
   }

The property Keyboard is set more than once

$
0
0

Hi,

I am trying to set the CapitalizeCharacter for an Entry which already has the Keyboard="Default" but getting:

The property Keyboard is set more than once

How can I fix this please?

Here is my code:

<Entry x:Name="TextBoxSignupFirstName" IsTextPredictionEnabled="False" IsSpellCheckEnabled="False" Keyboard="Default" FlowDirection="LeftToRight" HorizontalTextAlignment="Center">
    <Entry.Keyboard>
        <Keyboard x:FactoryMethod="Create">
            <x:Arguments>
                <KeyboardFlags>Suggestions,CapitalizeCharacter</KeyboardFlags>
            </x:Arguments>
        </Keyboard>
    </Entry.Keyboard>
</Entry>

Thanks,
Jassim


MVVM call OnAppearing()

$
0
0

Is there way to call OnAppearing() event in my ViewModel ?
I tried a lot but it looks like ther's no way.

Syncfusion Segmentation contrrol border

$
0
0

I am using segmentation control using syncfusion library. I have 3 segments. Border is not showing in between the segment. Only outer border is showing. How to customize it?

how to import an object in urhosharp

$
0
0

Hello,
I made made progress in my planetarium project: I know how to add urhosharp in my xamarin.forms project and how to show lines and write text. But I need to receive a boost.

The purpose is to make a planetarium. The user sees stars and can click on a star to select it and get informations.
I made a 3D scene with blender and python scripting with white filled circles around a sphere (500 stars are at the good position, facing the center). The light and the camera are in the center of the scene (see picture). I can render it.

Next, I need to import the objects in my xamarin.forms project.

These are few questions. If an Urhosharp expert could give me few indications, it could be great.

  1. I need to use Assetimport to convert my scene. Can I convert a full node with all the circles in it. Is there any step by step documentation ?
  2. what will I get? a xml file? 500 xml files? a mdl file?
  3. where should I copy these files to import them in my project?
  4. how can I import them in my code, what is the path?
  5. how can I import in my project a blender made material?
    I made python scripting in blender to draw the sky.
  6. would it be a better (faster or easier) solution to draw the sky in C# in the app?
  7. would it be a better (faster or easier) solution to draw the sky in urho editor with angelscript?

Thank you for your help and your advices

How to access a property of an element of a page in xamarin forms from Android and IOS projects?

$
0
0

How to access a property of an element of a page in xamarin forms from Android and IOS projects?

For example:

Button1.IsVisible = false;

but since the Android project.

How to change Page if i clicked popup button.

$
0
0

i want to make a Register page after Confirmation page.

if i did not click Confirmation page, I cannot register my information.

if i clicked confirmation page or button, i can created my Account.

Pseudocode

if (clicked confimation page)

i can Created and move next page.

public void confirmationpage(Eventarg)

Viewing all 77050 articles
Browse latest View live


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