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

During an iOS Build it stops with a Droid error MSB4094.

$
0
0

My setup: Visual Studio 2019 - current updates; Xamarin Forms - Latest build.

I am doing an iOS build (Build->Build Solution with the settings AppStore; iPhone; MyApp.iOS) and it seems to hang/stop with the message:
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(104,10): error MSB4094: "obj\Release\90\MyApp.Droid.dll;obj\Release\90\MyApp.Droid.dll" is an invalid value for the "OutputAssembly" parameter of the "Csc" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".

Questions:
1) If I am doing an iOS build, why is it messing with Droid?
2) How do I fix the error? I have tried clean and deleting the bin and obj files. I saw a suggestion to "uncheck Activate ClickOnce security settings” but I can't find such settings.


Center frame in a tablet screen

$
0
0

How to have a frame centered in the screen. The frame will have only a Label, an Entry of maximum 6 numbers width and a button.

Shell Content page destruction

$
0
0

Using 4.3, say I have 3 tab items, each of them having 2 ShellContent items.
I am using ContentTemplate to only create the times when I click on them.

Now since we have quite a large application we would like to destroy the Tab Items Shell Contents if they select another Tab, is this possible? In general how can we destroy a Content page once it gets the disappear event?

thanks

TitleView for ContentView

$
0
0

Hi,

How can assign NavigationPage.TitleView to a ContentView?

Thanks,
Jassim

Allow iOS PageRenderer to render as custom UIViewController

$
0
0

Summary

Update the PageRenderer class so that it can render as a custom UIViewController instead of just a UIViewController

API Changes

I propose two ways of doing this.

Make PagerRenderer generic, so the user can set the page like so:

CustomPageRenderer : PageRenderer

or, add a SetNativeControl() function so the user can set what control to render as, such as:

var myPage = new MyCustomUIViewController();
SetNativeControl(myPage);

Intended Use Case

There are a lot of libraries out there that are just classes that inherent from UIViewController, we can't really use them since PageRenderer will only render a Xamarin forms page as a UIViewController.

Force Change of android:textColor at runtime

$
0
0

I have the a TabbedPage Application and want to change the textcolor at runtime.

<Label Text="Color change works for this label, as i set textcolor" TextColor="{DynamicResource MyTextColor}"/>
<Label Text="but i want to have it work for all labels and other elements without DynamicResource=MyTextColor"/>

public partial class TabPage : ContentPage
protected override void OnAppearing()
{
    // this works
    Resources["MyTextColor"] = DarkTheme ? Color.Red : Color.Blue;

    // this does not work at runtime, textcolor defined in styles <item name="android:textColor">#43d5e6</item> does not update at runtime
    SetTheme(DarkTheme ? Resource.Style.MainTheme_Dark: Resource.Style.MainTheme_Light);
}

item name="android:textColor> is differently defined in MainTheme_Dark and MainTheme_Light and gets at once applied to new Pages (for example Navigation.PushModalAsync(new NavigationPage(new NewPage())), but it gets not applied to existing TabPage. I have to close my app and only afterwards, it correctly applies the new "item name=android:textColor> from the selected MainTheme.

How can I force to change android:textColor at runtime in the OnAppearing()-event?

Best way to create non full screen popup?

$
0
0

Hi,

I am trying to create a menu that will take over 80% of the screen.
This is a customer request and I can't use the master details.
I tried few popup lib but non of them gave me a solution for non full screen popup.

  • the white area will be a list control.

Thanks,

Ady.

Error Building iOS project on Xamarin Forms

$
0
0

Hi,

I am trying to build my iOS in my Xamarin Forms using Visual Studio for Windows but getting this error..

Kindly help...

Thanks,
Jassim


Direction for renderer

$
0
0

[Posted in University but board seemed a bit slow]

I am looking for advice on producing a window to render output into. I want to build game frames but I am unsure of the limitations Xamarin would have for this kind of function.

Another option is building an application in Unity if I can then somehow place my game inside a Xamarin application.

Xamarin.Android Crash on BluetoothLeScanner.StartScan

$
0
0

During testing Bluetooth application, I have cautch the following exception System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.' on call:

BluetoothLeScanner.StartScan

... It is very strange, and I even do not know where it is thrown ...

Have anyone faced with the same issue ?

Page loaded event?

$
0
0

Is there a good way to make your own page loaded event. I'm having an issue on android where if I build a table dynamically before the page is fully loaded (displayed) on the device that as you scroll, the content that is off screen disappears.

If I add the content while the pages is already fully loaded everything works correctly.

App Store Connect (Application Loader) publishing failed - Failed to parse altool output.

$
0
0

I'm getting an error when trying to publish an update to my app using the Application Loader on VS. I tried researching on the error but the error itself isn't really clear. It originally worked earlier, but I got a "missing Info.plist value. CFBundleIconName is missing in the bundle" so I simply migrated to asset catalog (didn't use asset catalog for icons before) and now I'm getting this error. I cannot copy and paste the error but a picture of the error can be found below.

Native linking failed error in xamarin for GoogleSign

$
0
0

I am following this tutorial for GoogleSign in my project. https://www.pujolsluis.com/google-client-plugin-for-xamarin/ .Works fine in android. But getting Native linking failed errors while rebuild in ios.

Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseInstanceID'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseNanoPB'
Native linking failed. Please review the build log.
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseCoreDiagnostics'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseAnalytics'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/GoogleSignIn'
Native linking error: clang: error: no such file or directory: '/Users/cybasetechnologies/Library/Caches/Xamarin/mtbs/builds/login2.iOS/0f92dcc98e9717a0d2643ed70077af70/obj/iPhone/Debug/mtouch-cache/FirebaseCore'

Deleted bin and obj folders in both mac and visualstudio; clean and rebuid; still error persists.Please help..

Creating a FontFamily for Xamarin.Forms & Android

$
0
0

I am trying to add a custom font (or actually fonts) to my Xamarin.Forms app. In my case, it is the Arial font. I have the *.ttf files for the regular, bold, italic, and bold italic variations, and want to create a font family for them as described at:
https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/resources-in-android/fonts
I have placed the files in the Assets folder of my Android project, and I am able to use them individually using the syntax such as FontFamily="arial.ttf#Arial". However, I am somewhat confused as to exactly how to create & use the *.xml file that includes the variations. The sample xml file does not have the font names or files anywhere in it, and I am not sure how to use the xml file after creating it. Can somebody help me? Thanks.

send files using bluetooth in xamarin forms ios and android

$
0
0

hello guys,

i am currently doing project for file transfer using Bluetooth between two device using xamarin forms(.net standard) but i cant find relevant documentation for how to do this i know there is a plugin for data transfer https://github.com/aritchie/bluetoothle but i am not sure if it can transfer files please help me out on this.

thanks in advance.


Best way to set a bound Picker SelectedIndex

$
0
0

Hello,
I have bound a Picker SelectedIndex to a public property of the ViewModel.
But when the user wants to edit an item of the model, he opens the page. Then I have to set the picker SelectedIndex to the value of the property of the item edited.
So I need to prevent the property to be modified by the Picker.
This is how I do. Is it the good way?

        private bool getPickerStarsSelectedIndex = false;
        public int PickerStarsSelectedIndex
        {
            get
            {
                getPickerStarsSelectedIndex = true;
                if (_currentSight.StarID > 0)
                    return convertStarIDtoPickerStarsSelectedIndex(_currentSight.StarID);
                else
                    return 0;
            }
            set
            {
                if (getPickerStarsSelectedIndex)
                    getPickerStarsSelectedIndex = false;
                else
                    _currentSight.StarID = convertPickerStarsSelectedIndexToStarID(value);
            }
        }

Issue with Android 10

$
0
0

I've been experiencing this issue with my current app after setting target framework to android:targetSdkVersion="29". I've double checked that this happens with a sample application for easier debugging. This is replicated with the WorkingWithNavigation sample app.

Anytime a page is pushed or popped off the navigation stack this error occurs. I'm assuming this has to do with the animation of the navigation.
Any ideas or thoughts on how to fix this issue?

11-09 11:57:51.138 W/avigation.Droi(18447): Accessing hidden field Landroid/view/animation/Animation;->mListener:Landroid/view/animation/Animation$AnimationListener; (greylist-max-p, reflection, denied)
11-09 11:57:51.139 E/FragmentManager(18447): No field with the name mListener is found in Animation class
11-09 11:57:51.139 E/FragmentManager(18447): java.lang.NoSuchFieldException: No field mListener in class Landroid/view/animation/Animation; (declaration of 'android.view.animation.Animation' appears in /system/framework/framework.jar!classes3.dex)
11-09 11:57:51.139 E/FragmentManager(18447): at java.lang.Class.getDeclaredField(Native Method)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.getAnimationListener(FragmentManager.java:1301)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.setHWLayerAnimListenerIfAlpha(FragmentManager.java:1283)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.completeShowHideFragment(FragmentManager.java:1746)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1822)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Handler.handleCallback(Handler.java:883)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Handler.dispatchMessage(Handler.java:100)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Looper.loop(Looper.java:214)
11-09 11:57:51.139 E/FragmentManager(18447): at android.app.ActivityThread.main(ActivityThread.java:7356)
11-09 11:57:51.139 E/FragmentManager(18447): at java.lang.reflect.Method.invoke(Native Method)
11-09 11:57:51.139 E/FragmentManager(18447): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
11-09 11:57:51.139 E/FragmentManager(18447): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

CollectionView.EmptyView is not showing despite count of items is 0.

$
0
0

Gathered from the documentation:

EmptyView, of type object, the string, binding, or view that will be displayed when the ItemsSource property is null, or when the collection specified by the ItemsSource property is null or empty. The default value is null.

So, im working on a Xamarin Forms app which only has the Android Module right now, I wanted to display a message like the example shown in the documentation by just providing the value of EmptyView like this:

EmptyView="No combos to display. Why don't you add some?"

This is added in the following code:

<CollectionView ItemsSource="{Binding ComboList}" 
               IsGrouped="True" SelectionMode="None"
               EmptyView="No combos to display. Why don't you add some?"
                           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}">
                    <CollectionView.Header>
                        <StackLayout>
                            <Label Text="{xt:Translate character_facing_right}"
                                   Margin="{StaticResource HeaderLabelMargin}"
                                   FontSize="Medium"
                                   HorizontalOptions="Center"/>
                        </StackLayout>
                    </CollectionView.Header>
                    <CollectionView.GroupHeaderTemplate>
                         ...
                    </CollectionView.GroupHeaderTemplate>
                    <CollectionView.ItemTemplate>
                        <DataTemplate x:DataType="models:ComboView">
                            <controls:ComboItem Title="{Binding Title}"
                                                Combo="{Binding Combo}"
                                                IsStock="{Binding IsStock}"
                                                Type="{Binding Type}"
                                                UniqueId="{Binding UniqueId}"
                                                Comment="{Binding Comment}"/>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                    <CollectionView.Footer>
                        ...
                    </CollectionView.Footer>
                </CollectionView>

However, when testing, i can see the header of my list but not the EmptyView, even though the list is empty. What am i missing?

Toolbar menu item customization

$
0
0
I would like to load image url to tool bar menu item. BUT from Google results I found that tool bar menu item accept only drawable image. Is there any possibility to load image url


Icon =Accepting only drawable image.

Requirement

Icon = load image url or font awesome icon.

How to notify or call viewmodel 's method from customview 's bindable property

$
0
0

Hi All, I need to call viewmodel method from customview whenever bindable property changed.

public class CustomPieChart : SupportPieChartExtended
{
public static readonly BindableProperty SelectedValueProperty = BindableProperty.Create(nameof(SelectedValue), typeof(string), typeof(CustomPieChart), null);
public string SelectedValue
{
get { return (string)GetValue(SelectedValueProperty); }
set { SetValue(SelectedValueProperty, value);

        }
    }

}

I am setting this value from customrenderer of CustomPiechart which I am able to but I need to call a method of viewmodel .

public class PaySlipPageViewModel : BaseViewModel
{
public string SelectedValuesSet
{
get => selectedValuesSet;
set {
SetProperty(ref selectedValuesSet, value);
Hello();}
}

public void Hello(){
{
Console.WriteLine("Hello");
}
}

In the UI

I need to reflect SelectedValuesSet from CustomPieChart Class whenever SelectedValue changed.

Please help

Viewing all 91519 articles
Browse latest View live


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