I would like to use this for my WPF application. WPF Battery Control.
It is about a IPhone based battery control in silverlight.
However, I have no idea how to go about it, and would like to ask for help.
Here is the link: http://advertboy.wordpress.com/2007/09/11/iphones-beautiful-battery-recharger-as-a-silverlight-animation/
And source code: https://skydrive.live.com/?cid=1e3f9e1e2f8bc994&id=1E3F9E1E2F8BC994%21221#
if you have the source, just make a WPF app, and add the code for the control. it should build w/o any problem.
silverlight is a sub-set of WPF, so most silverlight code should build w/o any problem. the reverse is not true, however--most WPF code won't build in silverlight.
The code you've linked to is a Silverlight 1 application, so porting isn't simply a case of copy the source across.
The XAML markup for the battery is in iTunesControls\Recharging\BatteryRecharging.xaml. Most of this appears to work as-is. Copy the entire contents of this file into a user control or custom control in your WPF project, and then remove the xmlns, xmlns:x and xmlns:a namespace references and the x:Class attribute from the root <Canvas> element.
To vary the amount of charge shown within the battery, set the Widths of the elements with names pthFiller and pthFiller1 to a value between 0 (empty) and 314 (100% full).
Related
I am working on a windows universal app called ProPlayer and you may see this preview app on Windows Store .
Now I am working on a new version and I used MediaElement instead of Microsoft player framework in this new version . I am trying to modify some parts of MediaElement but couldn't find any way . I used AreMediaTransportControlsEnabled to show this controls and generate a resource dictionary for media element style . I want to make background of MediaTransportControls transparent or change the opacity of these controls .
(source: picofile.com)
How does it possible
Not possible for the system default media transport controls.
You need to create your control or just simply put something like a stackpanel and put it into a popup control to replace the default system media transport controls, cause the system default one doesn't expose required property you want.
There is a tutorial and the relevant sample for win8.1. I didn't try everything in UWP, but the principle is same, so you can start from there. And you can add more cool design on the panel to make your ProPlayer more PRO. :)
As I know there is no treeview control in Windows 8 store app, does anyone know an alternative solution?I want to display some parent child data with collapse and expend on click of the header, but this is not possible in GridView and ListView of Windows 8. Can any one help me for this ?
There is a TreeView control in WinRT XAML Toolkit that has been ported from the Silverlight Toolkit.
Tree Navigator control from Syncfusion WinRT Studio may help to achieve your requirement. It supports hierarchical data binding. It also has two different navigation modes. The control provides a unique interface that can expand a tree structure in-place without taking up more space on the screen.
http://www.syncfusion.com/products/winrt/controls
I am trying to create a new Control (Let us for now forget about UserControl or CustomControl).
I open a Windows phone Application project in vs2010 and then add a new item Windows phone Control Library and then I use it in my phone application.
Everything works fine. Now if I want to create a windows phone control to be used in another application how should I be going about it? New application means a separate new solution.
Phone Application1 -> Have my own control inside the solution and hence I am able to use it.
How can I use this same control in another new solution?
I am not sure if this has been answered before. Does any solution already exist?
Cavet:
I tried creating a new Windows phone Class Library in a vs2010 instance but it didn't work because it didn't had a xaml form. When I tried to manually include it and write the logic it build successfully but now even if I include the dll of this project I don't get the control in the toolbox. This process does not make much sense to me as I am creating a class library and not a control but still wanted to give it a try.
To show controls from your assembly in the toolbox, you should do design-time assembly. You can look at these articles for the beginning:
Link2
Link1
It's not easy and perhaps you can live without that if your control assembly is not a commercial product. To use any control from other assembly in application:
add project reference to your control assembly
include xmlns namespace attribute corresponding to your assembly to any page of your application. Just start typing 'xmlns=' near other xmlns definitions in the page header and VS intellisense will show you the list of available namespaces. Choose the needed one and then set namespace alias to use on the page. It should look something like xmlns:myNamespace="clr-namespace:MyAssembly.Namespace.;assembly=MyAssembly"
insert control from your assembly into page using xaml editor
now you should be able to see your control in xaml designer and edit its properties from the property grid
.
I am not sure if the above mentioned method would solve the case, because as far as I have seen it is not possible to create a Windows Phone Control Library in VS2010. So this is what I did..
Created a Windows Phone Control Library and write my own custom control.
Build the project.
Back to Vs2010, added the reference to the control in the app in which I wish to use.
As simple as that. I don't know why it was initially a little bit confusing (perhaps I would have got confused with the binding and stuff). Anyways its quite simple though. Thank you for the reply.
I'd like to get ahead of the pack and start making some custom C# controls and components for Metro (Win8), but I can't find any documentation or blog posts on how to start, or even if it's possible right now.
Are metro controls just WPF controls? I'm not yet a WPF developer; creating a custom user control looks straightforward, but that project type doesn't exist in the Windows 8 developer preview. So, are WPF custom user controls (VS2010) the project type I should use for creating my Metro controls? Beyond that, I can't find any documentation on how to create a component for use in WPF/Metro; can you create one, or would it just be a custom user control that isn't visible? (I was hoping for some type of component container like the one winforms use; are components for Metro now only class libraries, and don't include designer support anymore?)
It's ... very difficult right now. There's no way to override OnRender or the like for a control, ie to create code to render a control with a custom appearance. However, you can create a custom template. Anything you can do in the template is legal, and that's how you have to approach custom controls.
One other option is to generate your UI using either raster (Bitmap) or vector (Windows.UI.Xaml.Shape?) components directly and build up your UI like that. Bleh.
Win8 Metro is a lot like WPF, but it isn't a subset. Similar but very different. Many WPF controls didn't make the transition to Win8 Metro; the same level of rendering control isn't available; and some system features (like advanced font rendering) aren't there. All this might change in coming releases, but right now it looks like Microsoft is trying to restrain developers from creating custom UI controls.
I have been trying to customize a webbrowser control in wp7. All I need to do is to add a border property(I think it is already available in webbrowser but I have to make it mandatory when I make it as a control) and want to add a few extra event handlers and make it as a control so that it can be used later in different projects.
I tried reading through materials in msdn for writing control template and it all revolves around writing a few xaml code and attaching it with codebehind to make it work. What I don't understand is how do I learn xaml? or in other words where is the reference for all the tags that msdn talks about in xaml? Itseems to be huge and I am not sure how to go about it. The tutorial in msdn straight away divulges into xaml code and I am totally confused..
So now all I am trying to do is this,
create a control in Expression Blend (Windows Phone Control Library) that would create a class (MyCustomControl) that inherits
from CustomControl base class.
Now in xaml I am adding a webbrowser control and adding four event handlers (mouseup,down etc.,).
I build this control in blend and add the corresponding dll in VS2010.
And now once I try to add this control to my wp7 phone application it says "Cannot create an instance of MyCustomControl"..
These were further links that I referenced in creating one,
Windowsphone - Creating a custom control
Windowsphone - Control Template.
UserControl vs Custom Control
Creating a new control by creating ControlTemplate
Any further help would be great.
There is no definitive list of 'elements' you can add to your XAML. The reason for this is that the XAML parser can create any class which is a UIElement based on the XML you provide. So the elements available to you depend on the assemblies present in your project. Read teh MSDN XAML Overview for details
For a list of controls that are present by default, take a look at the System.Windows.Controls namespace (I think this link is not for your version of Silverlight, it might be best to use the Object Browser to look at the assemblies in your project).
For your problem, where you want to add a border to a WebBrowser control. I would recommend creating a UserControl as per this tutorial.