Silverlight Create draggable control over image - silverlight

I want to build some GUI where an image is presented, and the user should pick nd/or adjust some points (ellipses) according to the image. Basically, like a map control, when we want to mark some points or make a route, but instead of a map, a picture must be presented. The final locations will be used for image processing. Is there a built-in silverlight functionality to do this? How should be the best way?
regards

for the Drag & Drop part, there is no built-in functionality in Silverlight so far (at least not for UIElements). But there are many implementations out there that provide this functionality, e.g. the DragDropManager on Codeplex:
http://silverlightdragdrop.codeplex.com/
These "workarounds" usually use mouse events and CaptureMouse/ReleaseMouseCapture to implement Drag & Drop behavior on UIElements.
Once you have Drag & Drop in your app, the rest should not be too hard. I'd place the image inside a Canvas and then move the markers around on that Canvas using the functionality provided by e.g. the Codeplex Drag & Drop implementation. Basically, all you have to do is set Canvas.Top/Canvas.Left for a marker based on where the mouse is.
Cheers, Alex

Related

How to build the following visual

I am not a real designer and I would like to know if anyone have an idea how can I build the following visual :
The idea is to get 2 rings where inside I will draw secific number of pie represented as "Interactive shape or button". Base on the number of shape, they should cover the whole circle.
In addition to that, I need to be able to interact with each pie shape, and inside and oustide edge of those shape should be a perfect arc based on the circle diameter.
As I am not a perfect designer, how can I represent this visual ?
I was thinking of using a custom panel but then how to draw each panel shape in order that they gets perfect inside and ouside arc and offer interactivity with each of them ?
Thanks for your help
I would appreciate samples as well
Theres actually a Silverlight tutorial on making something exactly like this.
If you didnt want to use that, you could always do it in javascript. Here's an example using Rapheal js
I would recommend looking into WPF Geometry and how you can create custom controls (such as the Circular Gauge Custom Control over on CodeProject) using said Geometry.
I've never created a control quite like what your suggesting, but I would image you would define some form of area that can contain children and style it so that it forms the circular shape you want. Then, adding interactive regions should be as simple as adding controls to standard containers.
Here's a link to a "generic radial panel that can be used to host any items" which subclasses Panel.

silverlight map application like showcase on silverlight.net

we want to make application like silverlight showcase Mapview
where we can search by different category on left hand side panel or people can select country or region on map. can anyone suggest some sample or guidelines to implement this?
Thanks
Given the complexity and obvious expense, I would be really impressed if anything like that was released as a sample (Microsoft are you listening?). It requires a lot of data to drive it.
I have been involved in creating a Xaml World map from scratch (below) and that alone took nearly a day for a stylised polygon version (no fine detail)....
Quoting myself: "You import a map as a background image and use the pen tool to dot-to-dot trace around the country. Combine all those path segments into a single path. Then create a separate poly-path for each state (close them to allow for a fill)."
Once you create them you can name the individual country polygons and connect up mouse logic to make them all glow on mouse over or change colour on press etc.
Basically all the other stuff on that screen are user controls and custom controls. Work out the behaviour you want and create controls to suit your own needs.

Silverlight 4: how to highlight control on mouse over

My aim is to get fine control "animation" when it is mouse-over-ed. For example, I have a "map" of controls (game map that represent different type of terrain), each of them is an image with trees/rocks/hills on the green grass or water (lake or see) image of blue/cyan color. When user point any image with mouse it should get shiny: either get more bright background or get a shiny border.
It is hard to say what exactly I want to have (either background change or border), I would like to try each of them and see what is the most appropriate for me.
I am going to have a custom control (MapTile) that will represent a map tile. I know how to catch MouseEnter/MouseLeave events, but not sure how to change control style and if it is a good idea to work with control style in CodeBehind, probably there are better XAML-based solutions.
Could you please help with a solution that provide few goals:
Goal1: Add highlighted border around the control (it will be squares/rectangles, or circles; use what is easier) on mouse enter, remove border on move leave;
Goal2: Change some properties of my CustomControl (for example, background color).
Thank you very much!
1. How to han
You might find it easiest to get hold of Expression Blend and use it to create a custom template for your control.
The Learn Expression Blend page would be a good place to start. Look for tutorials on customising buttons and this is the same sort of thing that you want to do.
You need to use an attached behavior on your control. You don't need to learn Blend for this.
Check this one as an example, but you can search the site for Mouse Over for other examples.
http://gallery.expression.microsoft.com/en-us/MouseOver3D

How to draw shapes on top of Silverlight multiscaleimage?

There is a multiscale image with deepzoom image as a source. Now I need to allow users to draw poligons and lines on top of the multiscalimage in such a way that the shapes will follow drag and zoom to scale accordingly.
I tried to add a canvas in addition to the multiscaleimage but can't figure out how to make them stick to each other on zoom or drags.
If you have done any user shape drawing on top of deepzoom image, please share your methods.
Thanks,
Val
Have you checked the Silverlight 4 Puzzle demo?
http://johnpapa.net/silverlight/silverlight-4-html-puzzle-how-does-it-work/
You may be able to get some "inspiration" by inspecting this app.
Follow the link to download the source:
http://www.silverlight.net/community/samples/silverlight-4/html-puzzle/
I've done this before. Not sure if this is the preferred/optimal way, but you can add layers to your root deepzoom layer. (sorry, i forget the proper terminology).
In my case i had 4 sub layers, some of which were used to render lines and shapes, others were used to render entire maps that were loaded from a URI.

WPF Flick along a path (Surface)

Im developing an app for Microsoft Surface and Im trying to make the most of the libraries that are out there, the functionality Im after if to be able to flick a UI element.
The ScatterView control makes this easy, but I would like to restrict the UI element to only be able to be flicked along a set path. This is where Im having trouble.
So my questions are:
1) Can you restrict a ScatterViewItem to only be flicked along a path?
2) If not, how would you implement a flick gesture to flick a UI element along a set path?
Thanks!
Mark
1) Not that I know of, and this probably isn't the best way to approach it.
2) Assuming you have the object you want flicked and the path at design-time, I've previously implemented dragging and flicking along a path by creating a timeline animation that represents the movement across the entire path. At runtime, I capture contacts on that object, feed them to a Affine2DManipulationProcessor, and seek the animation based on the manipulation events.
So in my case I was creating a drawer. When the user touched the drawer, I start the animation and pause it immediately. If the user drags it open, I seek the animation the appropriate amount forward based on how far the manipulation processor tells me they've moved.
To get the flick behavior, you just hand off the manipulation to the Affine2DInertiaProcessor and continue handling the delta events.
This all works surprisingly well.

Resources