Avalonia UI Carousel Example - xaml

I'm rather new to Avalonia UI / XAML / .NET MVVM in general. While I really like Avalonia so far, it's still in beta and lacks extensive documentation. Hence I sometimes struggle to get specific things working or finding out how I should use them correctly.
Could somebody point me to an example using the Carousel control? Which properties should I set in the xaml, what kind of item list should be behind it etc?
Cheers.

You can find usage example in ControlCatalog project from the main repository:
https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/CarouselPage.xaml
https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/CarouselPage.xaml.cs

Related

Xamarin.Forms embed native controls for WPF

Following Native Views in XAML I see that it is possible to embed native views in XAML by specifying a value for targetPlatform in an appropriate xmlns attribute value.
In my sample project I have confirmed this works for UWP by using targetPlatform=Windows. This actually works fine.
However I wish to do the same thing for a WPF control and was wondering which targetPlatform value to use. I see from the article that targetPlatform should be set to one of values of the TargetPlatform enumeration. Looking at the documentation for TargetPlatform enumeration I see that it is obsolete and does not have a value for WPF. (I tried to use Other but this does not work.)
I see that Device.RuntimePlatform may be used in code, but not sure if there is a way to use it with the xmlns attribute.
How do I conditionally embed WPF native views in XAML? If this is not possible, what's the best way to do this?
At the moment WPF support is in beta and it is not possible, as you can see it is on TODO list at the moment: https://github.com/mohachouch/forms-wpf-progress/blob/master/Status.md
You can port any view using the custom renderer, but adding and binding properties even for just one control is a huge work.

OpacityMask missing in UWP

Any easy way to apply OpacityMask to a UI object in UWP XAML?
I used to do that in WPF but appears to be missing in UWP.
You can partially replicate this functionality, but not in an especially easy way. Windows Composition API offers a similar functionality where you can define a CompositionMaskBrush with which you will "paint over" the UI object to achieve a opacity mask effect.
There is an example as the solution of a GitHub issue that demonstrates such process. The same user also asked on StackOverflow.
You can also check out the CompositionProToolkit that might simplify implementing this.

Using Path Animation in Windows 8 using XAML

I would like to animate a UI control (an Image actually) over a Path provided.
It is looking that it is not possible to do it in Windows 8 using XAML although it was possible with .NET 4.5 as far as I could see from the below reference.
http://msdn.microsoft.com/en-us/library/ms746981.aspx
My question is whether there is a work around that I can use to achieve my goal or get closer to it.
WinRT is very similar to Silverlight, so many Silverlight solutions can work in WinRT with minimal or no changes. This sample on CodeProject should give you DoubleAnimationUsingPath with little work.
http://www.codeproject.com/Articles/30819/Animation-Along-a-Path-for-Silverlight

Metro XAML Apps - DependencyProperty.AddOwner

Im writing some custom controls in Metro XAML, and I noticed the DependencyProperty no longer has the AddOwner method. Does anyone know if there is a new way of doing this in Metro ?
Add owner API has been removed from Silverlight and metro XAML as well. There is no equivalent API for this any more.
You should be able to yield similar ability by defining a new dependency property, and data binding them. But I know it cannot fully replace add owner. If you post your underlying motivation for add owner, we might be able to help.

Silverlight 4 wait/spinner control

I'd like to implement a spinner control (something along these lines) in Silverlight 4 to display during pending operations. There are several examples on the web for Silverlight 3 but I'm either unable to compile them into my project or they just flat out display nothing. In addition I'm unable to find any examples specific to Silverlight 4.
Can someone please post a sample for Silverlight 4 or a link to one?
You can use the BusyIndicator.
How To Work With Silverlight BusyIndicator?
Custom Busyindicator style in Silverlight 4
I found a good example of a spinner control here. It's very simple and may not be ideal but it works perfect for my purposes. It's a XAML-only solution so it is very easy to port.
If you decide to use it, then I'd like to echo one of the commenters' suggestions that you change the <Grid> to a <Viewbox> so that the spinner will scale automatically.
I've put together a pure xaml spinner out of another example I've found ( see source ). It works on silverlight 4 and moonlight 4 too.
Pure XAML Spinner
Slightly nicer visual than the "rotate some rectangles" approach.