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

MasterDetailPage with custom header?

$
0
0

Hi together,

in an app, I'd like to use the pretty cool MasterDetailPage for navigation.
Unfortunately, the header-part seems to be pretty fixed (what's not so nice).
Is it possible to define a custom header as replacement for the default?

Thanks for ideas!


Xamarin-Forms-Books-Samples-Master use PCL or Shared Project

$
0
0

This code for the book "Creating Mobile Apps with Xamarin Forms" is newer than the book. How can I tell if the new code(or any Xamarin forms) is using net.standard, PCL or shared project?

XForms preventing native use (custom renderers) of bottom toolbar in iOS so can't use

$
0
0

This subject is an extension and increased scope of another thread by @SvenKunttz at :

https://forums.xamarin.com/discussion/26804/how-to-transform-secondary-toolbaritems-to-uibarbuttonitems-in-the-bottom-toolbar-on-ios

The reason for this thread is to both clarify and detail the issue but also because it now appears that if one wants to utilise the bottom tool bar as used extensively on iOS apps, Apple’s included, then it doesn’t appear possible to do that with Xamarin.Forms currently.

To show the issue first a test project based directly on the Master-Detail Application (iOS Unified API) with the “A” code shown below added which merely adds in standard iOS bottom tool bar on both the Master page (just example refresh and pause options) and on the Detail page (just example camera and play options)

This results in the app looking like the screen shots 1 & 2 in attached file with bottom toolbar as standard and native that iOS users are used to.

The next text project is based directly on the Blank App (Xamarin.Forms Shared) with the “B” code shown below added to create an app functioning similar to Master-Detail Application. With this code the resultant app appearing as screenshots 3 & 4 with the clicking on the “details” button on the first page taking to the details page.

Now to add the bottom toolbar to this app one would’ve hoped that using the Forms ToolbarItems with Secondary option would do it but unfortunately this creates a tab bar at the top of the screen under the main navigation bar which is NOT iOS like, not compliant with Apple’s UI guidelines and definitely NOT what iOS users are used to so .. no problem, we can go native and use custom renderer(s) to gain access to the native objects and do anything native there as Xamarin directs for anything not possible via the Xamarin APIs .. or so we (Sven, myself, etc) thought! ..

Created two custom renderers in “C” code shown below, one for the MasterPage and one for the DetailPage with exactly the same code as in “A” but when one runs this the app appears as screenshot 5 in attached file with the complete screen blanked out .. in fact it looks like it's covered.

If we comment out the SetToolbarHidden line in the MasterPageRenderer (last line in inserted code) then the app appears fine on first page but when the details button is clicked nothing appears to happen and then master page is still there.

If we comment out the SetToolbarHidden line in the DetailPageRenderer the app works fine.

And just to note - if the SetToolbarHidden line is commented out then in both cases (Master and Detail) the ViewDidLoad is followed by the ViewWillAppear but if it’s left in (which we need to see the toolbar) then the ViewWillAppear is never called implying some error occurring between ViewDidLoad and ViewWillAppear in the XForms code itself causing the error.

So in essence it appears that if we want to use the bottom toolbar in iOS that is common and standard in many apps we can’t do it and use Xamarin.Forms which for me at least is a disaster!

I can understand that Xamarin.Forms can’t do everything we all want but in this case it actually prevents us using the standard native features by custom renderers.

Might this be a fundamental issue with Xamarin.Forms and hence perhaps why the ToolbarItems functionality in .Forms is inconsitant with the normal native look and feel in the first place?

@JasonASmith - could you let us know if there is an issue that prevents this native functionality being used in custom renderers or if there’s something in the .Forms code that is a “bug” (?) that’s causing this? If, as I suspect it maybe, it’s related to how the ToolbarItems has been implemented, is there a way to “turn that off” with a flag or something when we do our own thing for instance.

Hope there’s a solution to this, ideally of course having ToolbarItems render correctly in a native iOS standard way by using the bottom bar but if not then quite happy to use custom renderers but .. only they can work!

Code - “A”

MasterViewController.cs

public override void ViewDidLoad ()
{
base.ViewDidLoad ();
   NavigationItem.LeftBarButtonItem = EditButtonItem;
   var addButton = new UIBarButtonItem (UIBarButtonSystemItem.Add, AddNewItem);
   NavigationItem.RightBarButtonItem = addButton;
   TableView.Source = dataSource = new DataSource (this);

   // code to insert and show bottom tool bar items
   this.SetToolbarItems( new UIBarButtonItem[] {
    new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (s,e) => {
          Console.WriteLine("Refresh clicked");
      }),
      new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) { Width = 50 },
      new UIBarButtonItem(UIBarButtonSystemItem.Pause, (s,e) => {
         Console.WriteLine ("Pause clicked");
      })
   }, false);
   this.NavigationController.SetToolbarHidden (false, false);
   // code to insert and show bottom tool bar items
}  

DetailViewController.cs

public override void ViewDidLoad ()
{
base.ViewDidLoad ();
   ConfigureView ();

   // code to insert and show bottom tool bar items
   this.SetToolbarItems( new UIBarButtonItem[] {
    new UIBarButtonItem(UIBarButtonSystemItem.Camera, (s,e) => {
          Console.WriteLine("Camera clicked");
      }),
      new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) {Width = 50},
      new UIBarButtonItem(UIBarButtonSystemItem.Play, (s,e) => {
          Console.WriteLine ("Play clicked");
      })
   }, false);
this.NavigationController.SetToolbarHidden (false, false);
// code to insert and show bottom tool bar items
}

Code - "B"

public class App : Application
{
public App()
   {
    MainPage = new NavPage();
   }
}
public class NavPage : NavigationPage
{
public NavPage ()
{
    Navigation.PushAsync(new MasterPage());
}

public class MasterPage : ContentPage
{
public MasterPage ()
   {
    Title = "Master";
      var button = new Button { Text = “Detail” };
      button.Clicked += (sender, args) =>
      {
       Navigation.PushAsync(new DetailPage());
      };
      Content = new StackLayout { 
       VerticalOptions = LayoutOptions.Center,
         Children = {
          new Label {
             XAlign = TextAlignment.Center,
               Text = "Master Page"
            },
            button
         }
      };
ToolbarItems.Add(
new ToolbarItem("Edit", "", EditAction, ToolbarItemOrder.Primary, 0));
   }
   void EditAction()
   {
   }

public class DetailPage : ContentPage
{
public DetailPage ()
   {
Title = “Detail”;
Content = new StackLayout { 
       VerticalOptions = LayoutOptions.Center,
       Children = {
          new Label {
             XAlign = TextAlignment.Center,
               Text = "Detail Page"
            }
         }
};
ToolbarItems.Add(
new ToolbarItem("Done", "", DoneAction, ToolbarItemOrder.Primary, 0));
   }
   void DoneAction()
   {
}
}

Code - "C"

public class MasterPageRenderer : PageRenderer
{
public override void ViewDidLoad ()
   {
    base.ViewDidLoad();

    // code to insert and show bottom tool bar items
    this.SetToolbarItems( new UIBarButtonItem[] {
    new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (s,e) => {
           Console.WriteLine("Refresh clicked");
       }),
        new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) {Width = 50},
       new UIBarButtonItem(UIBarButtonSystemItem.Pause, (s,e) => {
          Console.WriteLine ("Pause clicked");
       })
     }, false);
   this.NavigationController.SetToolbarHidden (false, false);
    // code to insert and show bottom tool bar items
}
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
}

public class DetailPageRenderer : PageRenderer
{
public override void ViewDidLoad ()
   {
    base.ViewDidLoad();

      // code to insert and show bottom tool bar items
      this.SetToolbarItems( new UIBarButtonItem[] {
       new UIBarButtonItem(UIBarButtonSystemItem.Camera, (s,e) => {
          Console.WriteLine("Camera clicked");
         }),
         new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) {Width = 50},
         new UIBarButtonItem(UIBarButtonSystemItem.Play, (s,e) => {
            Console.WriteLine ("Play clicked");
         })
}, false);
   this.NavigationController.SetToolbarHidden (false, false);
      // code to insert and show bottom tool bar items
}
   public override void ViewWillAppear (bool animated)
   {
    base.ViewWillAppear (animated);
}
}  

ZXing.Net.Mobile.Forms crashing on Android with message "Camera service died!"

$
0
0

Hey guys,

I have a big problem with the ZXing.Net.Mobile.Forms package and my Android App.

After I navigated a few times to the Scanner Page, my Samsung Galaxy (A5) totally hangs and restarts. My Visual Studio Android Emulator (Marshmellow) is crashing also and throws the message that the connection to the emulator aborted. It no longer responds to mouse clicks, etc.

On Windows UWP it works without any crashes..
Xamarin Version 4.3.0.795
ZXing.Net.Mobile.Forms 2.1.47
Xamarin Forms 2.3.3.193

As desciped in the Gettings started guide (https://components.xamarin.com/gettingstarted/zxing.net.mobile.forms) I implemented the components into my Android App and started with the call of the components init method:

MainActivity.cs

        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);            

            global::Xamarin.Forms.Forms.Init(this, bundle);

            ZXing.Net.Mobile.Forms.Android.Platform.Init();

            LoadApplication(new App());
        }

And I set the permissions:

        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
        {
            global::ZXing.Net.Mobile.Forms.Android.PermissionsHandler.OnRequestPermissionsResult(requestCode, permissions, grantResults);

            //base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
        }

In the PCL I created a new XAML Content page and added the ScannerView:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="ProductFeed.Mobile.Views.ScanFeedQrCodePage"
             xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
             Title="{Binding PageTitle}">

    <Grid x:Name="gridMain" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Margin="0">
        <zxing:ZXingScannerView
            x:Name="qrScanner"
            VerticalOptions="FillAndExpand"
            HorizontalOptions="FillAndExpand" 
            IsScanning="True" 
            IsAnalyzing="{Binding IsAnalyzing, Mode=TwoWay}"
            ScanResultCommand="{Binding ScanResultCommand}">
        </zxing:ZXingScannerView>
    </Grid>
</ContentPage>

In the Visual-Studio output I can see the following message:

Releasing Exclusive access to camera
04-04 19:27:17.176 I/mono-stdout( 1709): Releasing Exclusive access to camera
04-04 19:27:17.176 W/CameraBase( 1709): Camera service died!
04-04 19:27:19.305 I/art     ( 1709): Starting a blocking GC Explicit
04-04 19:27:19.309 I/art     ( 1709): Explicit concurrent mark sweep GC freed 756(30KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 77us total 4.282ms
04-04 19:27:19.310 D/Mono    ( 1709): GC_TAR_BRIDGE bridges 96 objects 97 opaque 5 colors 96 colors-bridged 96 colors-visible 96 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.02ms tarjan 0.01ms scc-setup 0.01ms gather-xref 0.00ms xref-setup 0.00ms cleanup 0.01ms
04-04 19:27:19.310 D/Mono    ( 1709): GC_BRIDGE: Complete, was running for 4.84ms
04-04 19:27:19.310 D/Mono    ( 1709): GC_MAJOR_SWEEP: major size: 2016K in use: 1241K
04-04 19:27:19.310 D/Mono    ( 1709): GC_MAJOR: (LOS overflow) time 3.98ms, stw 4.16ms los size: 1024K in use: 198K
04-04 19:27:19.491 I/art     ( 1709): Starting a blocking GC Explicit
04-04 19:27:19.494 I/art     ( 1709): Explicit concurrent mark sweep GC freed 1042(32KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 76us total 3.174ms
04-04 19:27:19.495 D/Mono    ( 1709): GC_TAR_BRIDGE bridges 72 objects 73 opaque 5 colors 72 colors-bridged 72 colors-visible 72 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.02ms tarjan 0.01ms scc-setup 0.01ms gather-xref 0.00ms xref-setup 0.00ms cleanup 0.01ms
04-04 19:27:19.495 D/Mono    ( 1709): GC_BRIDGE: Complete, was running for 3.56ms
04-04 19:27:19.495 D/Mono    ( 1709): GC_MAJOR_SWEEP: major size: 2016K in use: 1018K
04-04 19:27:19.495 D/Mono    ( 1709): GC_MAJOR: (LOS overflow) time 4.12ms, stw 4.27ms los size: 2048K in use: 214K
04-04 19:27:19.625 I/art     ( 1709): Starting a blocking GC Explicit
04-04 19:27:19.628 I/art     ( 1709): Explicit concurrent mark sweep GC freed 1027(32KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 74us total 3.090ms
04-04 19:27:19.629 D/Mono    ( 1709): GC_TAR_BRIDGE bridges 68 objects 69 opaque 5 colors 68 colors-bridged 68 colors-visible 68 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.01ms tarjan 0.01ms scc-setup 0.01ms gather-xref 0.00ms xref-setup 0.00ms cleanup 0.01ms
04-04 19:27:19.629 D/Mono    ( 1709): GC_BRIDGE: Complete, was running for 3.95ms
04-04 19:27:19.629 D/Mono    ( 1709): GC_MAJOR_SWEEP: major size: 2016K in use: 1015K
04-04 19:27:19.629 D/Mono    ( 1709): GC_MAJOR: (LOS overflow) time 3.27ms, stw 3.65ms los size: 2048K in use: 214K

Did anyone experienced the same or have an idea what I can do ?

App.Current.Resources["text_size"] = App.Current.Resources["IOStext_size_small"]; blows up iOS

$
0
0

This works without any issue with Android, but iOS crashes after a couple resets of this resource.

Is this a known issue? Is it not possible with iOS to use a global dynamic resource?

Xamarin.Google.iOS.MobileAds Google Mobile Ads SDKs lower than version 7.0.0

$
0
0

Hi, I'm on Firebase but am currently using Xamarin.Google.iOS.MobileAds in a Xamarin.Forms project. Everything is working well.

i received an email from firebase that said Starting January 23, 2018, we will no longer be supporting Android and iOS Google Mobile Ads SDKs lower than version 7.0.0. To continue serving ads from AdMob after this date, please upgrade to the latest Google Mobile Ads SDK.

Is Xamarin.Google.iOS.MobileAds compliant (7.0.0 or >) i'm not sure how to tell.

Nuget Update: Support library does not exist in Android project.. What does this mean?

$
0
0

Does anybody know why this error would occur when upgrading Xamarin Forms via Nuget ?

Package 'Xamarin.Android.Support.Core.Utils.25.4.0.2 : Xamarin.Android.Support.Compat [25.4.0.2, 25.4.0.2]' does not exist in project 'MyApp.XF.Android'

Does it mean I need to update my Android SDK to the latest available version (ie Oreo, as I probably have another installed) ? Or is it something else ?

Is Android emulator work in Visual Studio 2017 Community?

$
0
0

Hi,

I am using Visual Studio 2017 community version. Currently, I am debugging on real devices.

Is Android emulator work in Visual Studio 2017 Community?


Back buttons dissappear in iOS 11

$
0
0

Ever since I updated Xcode and started testing my app in iOS 11 my back buttons have disappeared. I can still click them, but they are not visible. Anyone having this issue or know what it could be?

Is Android emulator work in Visual Studio 2017 Community?

$
0
0

Hi,

I am using Visual Studio 2017 community version. Currently, I am debugging on real devices.

Is Android emulator work in Visual Studio 2017 Community?

Why is the "ItemAppearing" event called for all ListView items when there are only a few visible?

$
0
0

Hello!

I got a grouped ListView with two groups and four item templates. They all have a few bindings. When loading the ListView it takes some time to render the rows, about 5 seconds... for 25 rows. In each row at the ViewModel i do a few calculations, for example calculating the week number of a specific DateTime and formate some lists. These calculations are heavy for all rows together.

Then i came across the "ItemAppearing" event. But this event is called for all rows, also for the rows that are not visible. I'm searching for a way to do heavy row tasks only when the row becomes visible, for example when the user swipes through the list.

Why is "ItemAppearing" called for all ListView items? Is this normal behaviour?

Listview.Itemappearing is not working in iOS 11 in iPad, does any Updated iOS 11affected?

$
0
0

****iOS 11 listview.ItemAppearinf issue on Ipad for xamarin froms

I dont Know How to set Id for a view in PCL (I dont have main.axml)[xamarin forms Android + PCL]

$
0
0

hello, In my new Job I'm asked to develop an android version from a xamarin forms huge project (electric component simulation application), they developed the iOS version. And the Android version is my task.

Note : Im new to xamarin forms and android too. and im stuck at this for more than 2 weeks now

I have created a custom renderer to drag and drop an image from listView (left side) to another one (grid ) (to create the electric schema from images)

My Question is how to set android:id="@+id/testgridID in --> PCL _______ not in (Resources/layout/main.axml) ____"""i dont have main.axml"""

Do I really need and ID ?? Should I create another custom renderer ??? Please help Im lost lost.....

I need the view with 'findViewById' to attatch to it a IOndragListener and drop the image.

I was able to select and drag the Image in my custom rennderer, like so ; (and still do not know how it has worked for me (Luck))


class DraggableElementImageRenderer : ImageRenderer, Android.Views.View.IOnTouchListener
{
...

bool IOnTouchListener.OnTouch(Android.Views.View v, MotionEvent e)
{
switch (e.Action)
{
case MotionEventActions.Down:
;
var Image = Element as DraggableElementImage;
GalaSoft.MvvmLight.Messaging.Messenger.Default.Send(new GalaSoft.MvvmLight.Messaging.NotificationMessage(Image.ElementItem, "DragElement"));
_prePos = new Android.Graphics.Point(oldrawX, oldrawY);
MyDragShadowBuilder my_shadown_screen = new MyDragShadowBuilder(v);
v.StartDragAndDrop(null, my_shadown_screen, null, 0);

            break;
            case MotionEventActions.Move: // this event IS NOT fired correctly when moving the the view; don't use it
                  break;
            case MotionEventActions.Up: // this event is never fired don't use it

                break;
            case MotionEventActions.Cancel:
###################################################################################################################### PCL graph.xaml file

<ContentPage.Content>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!--内容 Content-->
        <Grid Grid.Row="1" ColumnSpacing="0" RowSpacing="0" Padding="0" InputTransparent="{Binding IsShowElementSetting}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="384*" />
                <ColumnDefinition Width="384*" />
            </Grid.ColumnDefinitions>

            <!--回路図 Circuit diagram-->
            <Grid Grid.Column="1" ColumnSpacing="0" RowSpacing="0" Padding="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="125*"/>
                    <RowDefinition Height="800*"/>
                </Grid.RowDefinitions>

webview inside a scrollview scrolling problem windows phone

$
0
0

Hi,

I have a problem with showing a webview inside a scrollview on windows phone for xamarin forms. (Windows Phone 8.1 RT)

The problem is that the scrolling of the webview is blocking the scrolling of the scrollview. I tried a lot of things already, like disabling the scrolling in CSS, but this completely blocks any user input on the webview part, so I can't scroll there then. I also tried to put a transparent grid as overlay over the webview, this solves the scrolling problem then, but this disables the links inside the html content then.

I need the webview as child of a scrollview, because i have content above and below the webview. And the webview is needed because it has to show html content that comes from an API.

Is there maybe a way to show html content (with images and links) inside a label or so? I have done this on the iOS part of the app, but can't find an equivalent for windows phone. If not, is there a way to disable the webview scrolling without disabling user interaction on it? Or is there maybe another solution?

App crashes after updating Xamarin Forms to 2.4.0.18342

$
0
0

Hello !

I am using native views in my Xamarin Forms project. Everything was working well with Xamarin Forms 2.3.4.270. Now i want to update my project to Xamarin Forms 2.4. After updating XF package, when my app loads a view containing native views, I keep having this exception:

10-26 17:56:12.351 E/mono-rt (28353): [ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Sequence contains no matching element 10-26 17:56:12.351 E/mono-rt (28353): at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable 1[T] source, System.Func 2[T,TResult] predicate) [0x00011] in <a86d4e79c59b43fa837a1ec26cf8486e>:0 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.TryAddToProperty (System.Object element, System.String localName, System.Object value, System.Xml.IXmlLineInfo lineInfo, Xamarin.Forms.Xaml.Internals.XamlServiceProvider serviceProvider, System.Exception& exception) [0x0005d] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:510 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, Xamarin.Forms.Xaml.XmlName propertyName, System.Object value, System.Object rootElement, Xamarin.Forms.Xaml.INode node, Xamarin.Forms.Xaml.HydratationContext context, System.Xml.IXmlLineInfo lineInfo) [0x000a2] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:334 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ValueNode node, Xamarin.Forms.Xaml.INode parentNode) [0x00070] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\ApplyPropertiesVisitor.cs:58 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.ValueNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:86 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00043] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:143 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00078] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:145 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00078] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:145 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00078] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlNode.cs:203 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydratationContext visitorContext) [0x0007b] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlLoader.cs:141 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml) [0x0004b] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlLoader.cs:89 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType) [0x0002f] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\XamlLoader.cs:68 10-26 17:56:12.351 E/mono-rt (28353): at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Xaml\ViewExtensions.cs:36 Thread finished: #2

I have only updated the Xamarin Forms package.

Any ideas ?


How to Make Screen brightness to normal after change it

$
0
0

i'm recently create a method that make my screen brighter after barcode is shows up, its work fine with dependency service. But now i want to implement when the barcode is closed the screen brightness will be back to users phone brightness setting, and i cant find how to make that work. Here is some of my code

here is my AndroidBrightnessService
public void SetBrightness(float brightness)
{
var windows = ((Activity)Forms.Context).Window;
var window = CrossCurrentActivity.Current.Activity.Window;
var attributesWindow = new WindowManagerLayoutParams();

                attributesWindow.CopyFrom(windows.Attributes);
                attributesWindow.ScreenBrightness = brightness;

                attributesWindow.CopyFrom(window.Attributes);
                attributesWindow.ScreenBrightness = brightness;

                windows.Attributes = attributesWindow;
                window.Attributes = attributesWindow;


            }

and here is my interface
public interface IBrightnessService
{
void SetBrightness(float brightness);

    }

and here is the code to call the dependency service

protected override void OnAppearing()
{
var brightnessService = DependencyService.Get();
brightnessService.SetBrightness(.900f);
}

any sugestion how to implement it thanks.

How can i make an overlay animation?

$
0
0

Hello, I just started with Xamarin because my teacher forced me and... well what can i say i spent 24hours just to make a simple login screen.
but back to the topic: i want to make an animation to change screens. I made 2 sliding doors. They close, then the screen has to change, then they slide open again.
I tried EVERYTHING! combining the animated images in an absolutelayout with the rest of the content, changing between contents, some animation pipeline but it just won't work.
I bet i'm doing the screen switching wrong too because i just reset the content property of my main page.

Add custom row with buttons on Xamarin.Forms

How to play video with camera in xamarin.forms?

$
0
0

How to play video with camera in xamarin.forms?
Use plugin.media to record video, get the path in the returned File, and then use plugin.mediamanager to play video.
But it can't play, and the program crashes and throws an exception.
Exceptions are as follows:

There is no better solution. Thank you!

Styling of a custom button

$
0
0

Hi, I've got a question about styling of a button on Android platform. I made by own button class:

public class MyButton : Button
{
}

and here is a renderer for my custom button:

[assembly: Xamarin.Forms.ExportRenderer(typeof(Repro.MyButton), typeof(Repro.Droid.MyButtonRenderer))]
namespace Repro.Droid
{
using Xamarin.Forms.Platform.Android;

public class MyButtonRenderer : ButtonRenderer
{
}
}

So these are preety much empty classes. Here is my MainPage markup:

<StackLayout Orientation="Vertical">
    <Button Text="Sample Text"></Button>
    <local:MyButton Text="Sample Text"></local:MyButton>
</StackLayout>

I would expect to see two buttons with the same styling, however they look different:

Did I miss something? Do I have to explicitly call some method from base class to apply styling to my custom button?

Viewing all 58056 articles
Browse latest View live


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