How to use Toucheffect in Maui. In xamarin forms we can do it using the xamarin toolkit. - xamarin.forms

This is the shared touch effect files
This is the android platforms specific code
This is where I register the effect and the handler
This is where I used toucheffect nativeanimation property
Some properties are working , for example : the PressedOpacityBackgroundColor. Is there a way to make the native animation property to work
I tried from someone's code from where this issue was mentioned. I implemented as it is but the native animation property isn't working and also some other properties as well.

You can also use the Toutheffect in the MAUI.
You can add the Xamarin.CommunityToolkit.MauiCompat 2.0.2-preview1013 to your project. It is the .NET MAUI Compatible version of Xamarin.CommunityToolkit.

Related

How to add android attributes like android:id on Xamarin Forms(XAML)?

I've already tried setting android attributes like contentdescription by creating a custom element and setting the attribute on the renderer using the control.
Control.ContentDescription = ((MyEntry)e.NewElement).ContentDescription;
Is there a way to do it on the XAML rather than custom renderer?
Another, how can I set the android:id attribute? I've tried it change it on custom render but I think it's not working.
Sidenote: I'm using a RealWear device which can generats a script which has the UI elements of the page. The UI elements will contain the id attribute if it exists.
Hello and welcome to StackOverflow.
you can't add Android descriptions to xamarin forms elements.
Xamarin forms abstracts the ui to a non-native format (xaml) and converts the abstract definition of an element to a native one. However this happens "under the hood" and therefore you don't have direct access to that from xamarin.forms.
What you could do is, if you really need an element with a set id, you can either find a way to hack in your id using a custom renderer or you create and embed native elements.
For the latter please see the following microsoft article, which is a bit too much to include within this answer: https://msdn.microsoft.com/en-us/magazine/mt790186.aspx

Xamarin Forms with MvvmCross 5.7 First View not loaded

I have an Xamarin Application together with MvvmCross 5.7 and wanted to moved it completly to Xamarin Forms. It builds and starts as expected, but the first page isn't loaded.
I created the projects based this template: https://github.com/martijn00/MvxForms
Also I created a test project to see if something is wrong with my existing project: https://github.com/NPadrutt/XFTestProject
Can anyone point out what I am missing?
Either add a SplashScreen Activity who inherits from MvxSplashScreenActivity and with the method override:
protected override void TriggerFirstNavigate()
{
StartActivity(typeof(MainActivity));
base.TriggerFirstNavigate();
}
Or add these lines to the OnCreate Method in the MainActivity:
var startup = Mvx.Resolve<IMvxAppStart>();
startup.Start();
InitializeForms(bundle);
You don't neet to call startup.Start() in your MainActivity nor you need to init xamarin forms. It's done for you now (check RunAppStart method in mvvmcross sources for MvxFormsAppCompatActivity class).
From a quick glimpse at your GitHub repo, it looks like you're not decorating your view (i.e. WelcomView) with [MvxContentPagePresentation()] attribute (e.g. example from MvvmCross Playground). Add it in your WelcomeView.xaml.cs file and check if that helped
If it's a fresh project, you might want to consider using latest version of MvvmCross (v6). There's an awesome step by step guide to setup Xamarin.Forms with it by Nick Randolph

Setting an Android Tint Color Pre Lollipop

I have written an Android custom renderer for a checkbox control.
I set the checkbox disabled color like so
Control.ButtonTintList = ColorStateList.ValueOf(element.DisabledColor.ToAndroid());
where Control is an Android.Widget.CheckBox
This does not work prior to Lollipop and I get an error
CheckboxRenderer.SetDisabledColor (Incident.UserControls.Checkbox
element) Java.Lang.LinkageError: no method with
name='setButtonTintList'
signature='(Landroid/content/res/ColorStateList;)V' in class
Landroid/widget/CompoundButton; no method with
name='setButtonTintList'
signature='(Landroid/content/res/ColorStateList;)V' in class
Landroid/widget/CompoundButton;
I have found some mention of using DrawableCompat to do this but can't figure out how to do it in Xamarin/C#
Any ideas?
using Android.Support.V7.Widget.AppCompactCheckbox instead of Your base Android.Widget.Checkbox might do the trick.
Also to change colour at runtime you could use this:
ViewCompat.SetBackgroundTintList(_YourView , ColorStateList.ValueOf(Color.ParseColor(Resources.GetString(Resource.Color.blueLine))));
Actually, the problem with things not working pre-lollipop is that Android KitKat is obsolete and so are the rest of the versions below so to have features that are new to Android you need to use the Appcompact library for backward compatibility.
Anyways, Goodluck! Happy coding

FullCalendar does not apply css on changeView in Vaadin framework

I'm building a calendar plugin for Vaadin (see https://vaadin.com/). Everythng works fine, the stylesheets are applied EXCEPT when I programatically change the view. The view changes but the Fullcalendar styles do not apply correctly! See sample screenshot.List View after changeView called
I need to hit refresh for the styles to apply correctly.
(If I just change the view using the full calendar 'built in' buttons at the top right, the styles are applied.)
Using FullCalendar V3.7.0 and and Scheduler trial 1.9.0
Vaadin is a GWT framework, using V6.8.
GWT code for calling changeView:
private native void changeView(JavaScriptObject cal,String view,String nid)
/*-{
cal.fullCalendar("changeView",view);
//cal.trigger( "create" ); trying to fix the not-applying .css problem
}-*/;
'cal' is the original selector returned by jQuery.
Any ideas how to fix this?
Found the problem. It was due to the Vaadin framework removing FC's style class from the topmost element. To fix, I simply added these back using the framework's setStyleName("fc fc-unthemed fc-ltr");.

Xamarin Forms - Android Images Not Appearing

When I run my app on an iphone, all the images come up great. But when I tried running it on an android, none of the images showed up at all. The images were placed in both the ios and android folders (Android/Resources/drawable).
Anyone know why the images don't appear on an android?
I solved this exact problem by loading the images in the code behind.
The only way downloaded or filesystem retrieved images outside of the projects namespace work in Xamarin.Forms for Android is in the codebehind. Binding to the ImageSource will not display them. The problem has something to do with OnAppearing never setting or refreshing the property even if you set WidthRequest and HeightRequest. I'm actually not sure why but I have tested this process for a couple of weeks with no success. What I mean by this is the ViewModel is where you retrieve the image from a WebService or from the Filesystem then get and set your ImageSource this code typically will run on creation of the ViewModel or OnAppearing. There is a bug in the system with XAML so it will never work. Using the Codebehind and setting it directly is the only way the images will display. I don't know why this behaves this way but I have tested every conceivable way to do this and it does not work with ImageCircle or Image whether you set the ImageSource.FromFile or ImageSource.FromStream. It does work when you set the ImageSource in the XAMLs code behind using the Image object directly. If you read through this article on Images in Xamarin Forms it will explain which ways you can use XAML and display the the images using Embedded Resources and using.
https://developer.xamarin.com/guides/xamarin-forms/working-with/images/
<Image Source="{local:ImageResource WorkingWithImages.beach.jpg}" />
The only runtime ImageSource binding that seems to work is using a web address and pulling from the URI.
<Image Source="https://xamarin.com/content/images/pages/forms/example-app.png" />

Resources