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

Dynamically loading Shell TabBar Tabs

$
0
0

Hi,

Attached VS2019 (Windows) Shell solution is loading TabBar Tabs dynamically. The issue is TabBar.Tab.Items.Clear() results in page not loading in iOS, and in Android only one of the 2 tabs has data.

What am I doing wrong?

See AppShellViewModel.cs

Thank you.

 class AppShellViewModel: BaseViewModel
 {
    private ObservableCollection<string> accounts = new ObservableCollection<string>();

    public AppShellViewModel()
    {
        Task.Factory.StartNew(RefreshAccountListAsync);
    }

    public ObservableCollection<string> Accounts
    {
        get => accounts;
        set => SetProperty(ref accounts, value);
    }

    private void RefreshAccountListAsync()
    {
        IsBusy = true;
        Accounts = new ObservableCollection<string>(new List<string>() { "Account1", "Account2" });

        Tab resultsTab = PickerTestApp.AppShell.Current.FindByName<Tab>("resultsTab");
        Xamarin.Essentials.MainThread.BeginInvokeOnMainThread(() =>
        {
            //On Android, clearing Items works.
            //On iOS, app does not load at all
            resultsTab.Items.Clear();

            //On Andoid: Account2 never loads ItemsPage
            //On iOS, app does not load at all
            foreach (var account in Accounts)
            {
                ShellContent resultsSC = new ShellContent();
                resultsSC.Title = account.ToUpperInvariant();
                resultsSC.Route = account;
                resultsSC.ContentTemplate = new DataTemplate(() => { return new PickerTestApp.Views.ItemsPage(); });
                resultsTab.Items.Add(resultsSC);
            }
        });

        IsBusy = false;
    }

}`

How can I pass parameters like a local web page?

$
0
0

I have a local webpage for showing charts and I want to pass some information to the webpage.
I used MVVM ,How should I do

Multi Content Pages

$
0
0

Good day,
I believe there can be more than one content page in a project.
How can I call a content page from another.
I appreciate your kind help.

Thanks/Regards.

Can DependencyService be used in Multiplatform library project?

$
0
0

Can DependencyService be used in a Multiplatform library project - to call platform specific code?

Java.Lang.ClassCastException

$
0
0

I am getting this error when i am integrating app with Xamarin forms can help pls.

Find the attached error screen.

Shell navigation routing Query properties are null

$
0
0

Query properties are null while using shell gotoasync

await Shell.Current.GoToAsync($"userDetails?id={id}");

UserDetailsViewModel:
[QueryProperty("Id", "id")]
public class UserDetailsViewModel : BaseViewModel
{
private string _id;
public string Id
{
get => _id;
set => SetProperty(ref _id, value);
}

    public UserDetailsViewModel(){
      var x=Id;
    }
}

OpenTok Xamarin.Forms nuget Video Chat

how can i recognize long press gesture in xamarin forms

$
0
0

Hi,

Could you please let me know how can i recognize long press gesture in xamarin forms application. Also let me know how can i implement left & right swipe

Thanks & Regards,
Siva


iOS Binding Unity as a library

$
0
0

Hi all,

I don't even know where to start :D

Since alpha 2019.3 Unity offers the feature "Unity as a Library" https://blogs.unity3d.com/2019/06/17/add-features-powered-by-unity-to-native-mobile-apps/ which I'm currently trying to integrate into one of our Xamarin Apps.
There are descriptions how to do that natively for Android and iOS which I got both working fine.
Just for reference:
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-ios-app.685219/
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-android-app.685240/
This is actually a really big deal so it is great working on it :D

However, I got it working fine for Xamarin Android. Now I'm trying on iOS which appears to be much more complicated.

The unity project will be exported as a native Objective-C++ framework (I think at least as there are .mm files using Objective C)
When using Sharpie to bind the framework I get a super large APIDefinitions file.
After some research I figured out that I have to define a scope to the Headers of the Framework, then the APIDefinitions are in fact much smaller and only reference the header files.

Now to my (current) problem:

If I open the ApiDefinitions then there is an interface UnityFramewok which comes from the UnityFramework.h file.
But this header holds a reference to a class UnityView which is not part of the headers. It is within the framework( at least it is within the Library project in Xcode so I assume it is bundled into the framework.)
I copied the .framework into the bindings Native References but I can't see any actual change happening when I do that.
The UnityView can not be found within the interface and I also can't import it from the library because the native reference is not available.

So how can I reference to a class of the framework from within an interface that is defined in the ApiDefinitions?

Thank you already!

Added a permission to the app automatically

$
0
0

After I get the program out, android.permission.REQUEST_INSTALL_PACKAGES access is automatically added to the program, I checked all the plugins used in the program, but none of them used this access.
Does anyone have a solution to this problem or has it already had this problem?

How make a circle label?

$
0
0

Hi, i have a list of label and i have to add into a label a text and then a counter. The counter must be a circle with a number in it.

This is the code of the counter:
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="6*" /> <ColumnDefinition Width="4*" /> </Grid.ColumnDefinitions> <cr:ExtendedLabel x:Name="InnerLabel" Grid.Column="0" FontSize="25" FontWeight="Normal" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="End" TextColor="White" VerticalOptions="CenterAndExpand" VerticalTextAlignment="Center" /> <Label x:Name="Etichetta" Text="1" Grid.Column="1" HorizontalTextAlignment="Start"/> </Grid>
This code just to that...

Does anyone knows how to do that circle for the counter?

Thanks a lot

Incomprehensible documentation

$
0
0

Hello everyone,

I really have trouble understanding this documentation.

docs.microsoft.com/fr-fr/xamarin/xamarin-forms/app-fundamentals/localization/text?tabs=windows

I am trying to make a language selector at the beginning of my application.

Except that when I use Resx resources files to assign each language with my strings.
There is a compilation problem and the resource files are not generated.

Example:
Severity Code Description Project File Line Deletion Status
Error The ResXFileCodeGenerator custom tool could not create an input file 'Resx \ AppResources.com.resx', but did not log a specific error. #### C: \ Dev \ Projects \ ##### \ #### \ Resx \ AppResources.resx 1

and that :
Severity Code Description Project File Line Deletion Status
Error CS0229 Ambiguity between 'Resource1.resourceMan' and 'Resource1.resourceMan' #### C: \ Dev \ Projects \ #### \ Resx \ AppResources.com.Designer.cs

I stress that Microsoft documentation does not provide enough detail, it is frankly poorly written and it is sorely lacking pedagogy!
Because I have no sources of information about the problem.
And I really have trouble understanding how this service works.

Most sample (sample) samples are no longer relevant and do not work, for example:

www.youtube.com/watch?v=Kfp4pc2elTU

www.youtube.com/watch?v=DT9vswQglks

Their plugin is non-functional!

If you have sources of information much more explicit than the microsoft documentation (which is a #&$@€&amp;). I thank you very much because there I am completely blocked!

How to debug network related Xamarin.Forms Image loading errors?

$
0
0

I have a Xamarin.Forms app acting as API client and accessing images loaded from the network, some or all of these images are on CloudFlare (CDN?).

I am using the defauilt ImageView with

Depending on the network the mobile client is located in, the images are not loaded (I have problems on UPC home broadband with WiFi). Other networks are fine and the images are loaded.
1.
2. Now how can I debug Image loading?
3. How can I tap into the network stack of Image and read server responses?
4. Are there any tool for it?

I havent yet switched to FFImage Loading because last time I played with it and used it purely from XAML, I got HTTP Header Timeout Exception (sor something similar, cant remember for 100%) so I am a bit vary of FFImageLoading. I would perefer it to swallow exceptions when using it from XAML...

Thanks for the advices in advance folks!

Images are embedded in this fashion (obviously I am still playing with the layout):

<Image InputTransparent="True" Aspect="AspectFit" VerticalOptions="FillAndExpand" HorizontalOptions="Start" HeightRequest="75" WidthRequest="50"> <Image.Source> <UriImageSource Uri="{Binding ImgSmSrc}" CacheValidity="0" CachingEnabled="False" /> </Image.Source> </Image> And: <Image> <Image.Source> <UriImageSource Uri="{Binding ImgSmSrc}" CacheValidity="0" CachingEnabled="False" /> </Image.Source> </Image> And: <ImageButton HorizontalOptions="FillAndExpand" Aspect="AspectFill" HeightRequest="250" Command="{Binding ImageStepCommand}"> <ImageButton.Source> <UriImageSource Uri="{Binding Path=Movie.GalleryDisplayImage}" CacheValidity="0" CachingEnabled="False" /> </ImageButton.Source> </ImageButton>

How to set snapped item as selected item in collectionView

Collection View not showing in master detail page

$
0
0

why is it that when l use the following code in my master detail page app.xaml.cs the collection view on the page does not show

 public App()
        {
            MainPage = new comicAppFinal.MainPage();
        }

but when the code below the collection view shows but l can not access the masterdetail page functionality anymore.

public App()
{
   MainPage = new Navigation(new MainPage())
}

Please provide me source to create chat application

$
0
0

I am new in xamarin.
Please provide me source to create chat application

How to Authenticate an user using ADFS in xamarin forms?

$
0
0

Hi All,

I am new to xamarin forms. I need to authenticate the users using ADFS. Please guide me what are all prerequisite needed and how to achieve this ?

How to convert Existing Xamarin Forms Master Details app to AppShell?

$
0
0

If am converting an Existing Xamarin Forms Master Details app to AppShell do I replace MasterDetailPage page with AppShell flyout menu?

[macOS] How to rotate Label or StackLayout with Labels ?

$
0
0

Hi,

I saw many samples how to rotate elements in Xamarin.Forms
for ex.:

<StackLayout Rotation="-90">
   <Label Text="AAA" />
   <Label Text="BBB" /> 
   <Label Text="CCC" />  
</StackLayout>

but it doesn't work when you run XF app on macOS (probably a bug).

Is there any solution how to achieve this in different way ?

Where is $(MSBuildExtensionsPath) located?

$
0
0

When creating a iOS Library porject and opening the csproj file I see <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> in the bottom. What is $(MSBuildExtensionsPath)and what is location of it?

Viewing all 91519 articles
Browse latest View live


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