Can a live tile style be created in WPF? - c#

I'm exploring MahApps framework and I want to implement a live tile style.
My question is:
Is it possible to create a live tile style, where the tile's content (predefined images, texts; not content added dynamically) should change periodically and with an animation (MahApps transition)? If so, how can it be done?
I think this behavior could be achieved in code, but I'm wondering if it can be done only in xaml, in a style. Thank you!

Yes. It is possible, but it's a hell of a work. I've done it onces before a couple of years ago. I've used this as my guide for it: http://www.sourceblog.mc-auto.info/post/2011/11/23/Live-Icons-in-WPF.aspx
Another take on it would be to get the WP7 silverlight toolkit http://phone.codeplex.com/ and take a look at the HubTile and convert it to your needs.

Related

Using a transparent background image on datagridview

I managed to build a darts scoring app programmed in C#(Winforms).
For scoring I used a Datagridview. Everything works quite nice so far, but for design purposes I'd like to use semitransparent Background Image, like I used for the Panels.
Unfortunately the Datagridview it self has no Background Image Property, so i wonder if its possible to customize Datagridview to achieve the following:
Background Image for The Control itself and transparent Background for Cells?
I would be happy if someone can help me because i don't understand how to customize the appearance of Controls.
Thanks in advance.
Sorry for my english.
I have not done it, but it should be possible by creating a new control inheriting from the DataGridView as described in this post:
https://social.msdn.microsoft.com/Forums/windows/en-US/628f8b29-1192-4c67-bae9-91547dd37039/assign-background-image-to-datagridview?forum=winforms
But I think you should consider an alternative approach which is to use a 3PP control known as ObjectListView, which can support background images.
Details can be found here:
http://objectlistview.sourceforge.net/cs/index.html
This requires a different approach, but once you master it then it is very powerful and very useful.

Xamarin Forms carousel with menu/tabs

I want do create something like TabbedPage but as a View with scrollable "menu" ( I will have about 8 tabs). How can I achive this? I was thinking about doing CarouselView and somehow to make a tabbed header, but I dont know how to make it good. Or maybe there is a plugin for TabbedView ( I spent few hours and I didn't find anything). Thanks in advance.
James Montemagno made a a brilliant blog on how to implement this a couple of years ago.
That sorts out the Carousel View. Now to write the tabbed header I wrote 1 of these a couple of years back. What you need to do is make a stacklayout with orientation horizontal, make the width bigger than the screen width and then every new page you visit you can translate the top bars x coordinates to the left or right. and change the image in the bar so that it looks highlighted.
Have a real play with this, see if you can make the transitions between pages smooth and the translation look sleek. I managed to do it so Im sure you will be fine.
I would provide code but unfortunately it was for a client and I cannot share his intellectual property.
Xamarin.Forms does not provide a TabView control but only a TabbedPage which seems to be no good in your case. There are commercial third party libraries that offer such a control out of the box (e.g. from SyncFusion). I looked quite a long time into this issue. Finally, I went for creating my own implementation which is based on a data bindable StackLayout with a horizontal line of buttons. Only the ContentView that is associated with the selected button is shown all other ones are hidden.
Check out this link on the old Xamarin forums here
I think this is exactly what you're looking for here. I had do a few things to get the sample to run like upgrade the version of Xamarin.Forms, then delete the nuget package for carousel view prerelease since its since rolled in with Xamarin.Forms.

What WPF control to use for a series of images (like Netflix, Hulu, etc..)?

New to .Net and Visual Studio. Quickly learning. As my first application, I am building a program similar to Netflix and Hulu (without the streaming part). Coming from a web background, I'd use tables and divs to accomplish what I am trying to do.
What component would I use to create a series of thumbnails (as you would find on Netflix) of the movie / TV show. Provided an image below as an example.
It would continue on with horizontal scroll. I understand this would be non trivial and I'm not expecting a direct answer. However, I am resourceful person and only would need to be pointed in the right direction.
Thank you.
You should use an ItemsControl variant which could be ListView with ScrollViewer.
Or, a WrapPanel with ScrollViewer.
Or, a UniformGrid.
Apply scrolling support using Animation.

how to save Canvas as image in WINRT using c# [duplicate]

I am developing a paint like application in metro style with C#/XAML. I want to save whatever content is drawn on canvas as image. I have checked this solutions but it didn't helped me.
Save canvas to bitmap
http://blogs.msdn.com/b/saveenr/archive/2008/09/18/wpf-xaml-saving-a-window-or-canvas-as-a-png-bitmap.aspx
So how can I save the canvas content as image ? Please help me with sample coding.
The accepted answer from Sascha is no longer true for Windows 8.1. There is a new RenderTargetBitmap class that allows Rendered XAML to be converted to a bitmap.
See: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.imaging.rendertargetbitmap.aspx
However I can't seem to render that XAML is Collapsed or otherwise not currently on screen. Any help with that would be appreciated!
It seems it is currently not supported out of the box like we were used to do it with WPF:
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/dd66c749-efed-4b55-a716-e0aa3a637d28
While when doing HTML5/Javascript Metro apps you can do this:
http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/cf8c17dc-68d4-4777-951f-bb7f0665bd06
The standard approach in other xaml frameworks such as Silverlight and WP7 was to use WriteableBitmap, however the version in WinRT doesn't have a constructor that takes a xaml element which leads me to believe that it's currently impossible against the latest API.
Sorry I couldn't be more help/
One workaround is to use Direct2D with DirectWrite. It is a bit involved, but I might make a library available at some point.

How to change ListView background image layout?

I've tried to find a way to change the layout of the background image on the ListView control.
I've searched around but haven't got any straight answer.
I can see that there is a ListView property BackgroundImageLayout which is supposed to do the job. But when i change it nothing really happens beside that the BackgroundImageLayoutChanged event is triggered.
How it is possible to change the BackgroundImageLayout on the ListView control? Is there any possible workaround to achive my goal?
PS.: I know about 3rd party controls that 'fix' this problem, but I'm looking for a solution that would do the task without any additional components.
ListView is a native Windows control. Yes, it does support a background image, the LVM_SETBKIMAGE message takes care of it. It however doesn't support the boilerplate Winforms BackgroundImage support, notable lacking is BackgroundImageLayout, the property that Winforms implements for the Control class and implements when the ControlStyles.UserPaint is turned on. It is not for native Windows controls, they paint themselves.
The guy that wrote the Winforms wrapper class for ListView did the next best thing, he added a new property to the ListView class called BackgroundImageTile. A layout option that the native Windows control does implement. Which leaves you with just the two layout options that the native control supports. Tile or don't tile.
That same guy did some pretty heroic things to make the Winforms wrapper class behave reasonably. The code is filled with hacks to work around the native control's quirks. Awesome work. His life would have been a lot easier if the Windows team guy would have the luxury to make the Winforms guy's life easier. But it doesn't work that way, ListView has been around a lot longer than Winforms. And wasn't designed that well from the getgo, Microsoft had pretty significant growing pains around that time.
Fast forward and change the rules so you don't depend on legacy code: WPF, Silverlight, WinRT.
According to the MSDN, 'ListView.BackgroundImageLayout Property':
"The API supports the .NET Framework infrastructure and is not
intended to be used directly from your code."
and
This property has no effect on the layout of the background image of the ListView control, therefore it is not shown in the designer or by IntelliSense.
Use the BackgroundImage property to set the background image. See msdn for more info:
That is unless you have something fancy you are trying to do with it?
EDIT: As per a previous thread HERE: the short answer is that you can't. =(
If you desparately want it, try creating a blank image that is the dimensions of your ListView. Add to this image YOUR image and add at it a position that is in the middle. There may be something similar in nature to this in under Bitmaps or Images.

Categories