I'm looking for a dockable windows/panel control in the style of iGoogle. All of the ones I have found so far all have a fixed length on the height of your window/panel but I want to be able to have windows of varying length like iGoogle.
The best I have found so far has been a control libarary called BlackLight which does not have the feature explained above.
have you seen this docking library:
http://www.codeproject.com/KB/WPF/WPFdockinglib.aspx
Related
I'm using a shared code to produce documents in Silverlight and WPF. But the output is different for the TextBlock alignment.
For example for a TextBlock of height 100, displaying a text in Arial with a FontSize of 100 :
In WPF the BaselineOffset is 92.16333
In Silverlight the BaselineOffset is 90.52667
This difference depends on the font family, for example if I replace Arial by Times New Roman :
In WPF the BaselineOffset is 91.23666
In Silverlight the BaselineOffset is 89,11
Is there a way to correct this behaviour and have the same alignment in WPF and Silverlight ?
Thanks for your help
Having worked in both WPF and Silverlight, I can confirm the rendering output of the same fonts at the same font size the output looks significantly different on screen.
In WPF you have a bit more control using RenderOptions i.e.:
RenderOptions.SetBitmapScalingMode(tb, BitmapScalingMode.NearestNeighbor);
RenderOptions.SetClearTypeHint(tb, ClearTypeHint.Auto);
RenderOptions.SetEdgeMode(tb, EdgeMode.Aliased);
You may need to play with values above to get as close as possible. Also as the renderoptions API is WPF only, if you're in a shared codebase you'd need to wrap it in a #if WPF directive..
In Windows Phone UI Design Principle, MS recommended use solid color rectangle or coding-gradient for Control Background to avoid incompatible in multi-screen. But in many requirements, using image as Control Background is necessary. Then, 9-patch image technique is used. In Android and IOs, it was support in core, but in WP it is lacking. I try to use it in WP by 3 approaches:
Using 9-cells Grid: clip image into 9 patch and lay them into cells. It works ok, but i afraid app performance reduce when has many control.
Using Custom Brush: only custom Brush to draw 9-patch image as ImageBrush, but seem MS not allow for custom Brush.
Using FramworkElement: like Rectangle, Ellipse... i want to create a FrameworkElement can draw a 9-patch image. But, can't use low-level render.
How can i implement 2nd and 3th approach?
I created a lib for Windows Phone which do exactly as Android NinePatchDrawable. You just need to set a bitmap image.9.png, the width and heigh... And done!!! you have you new image scale to the size you want. Enjoy it :). In the future I will add more option :).
GitHub link
You can compensate for the lack of low-level rendering and custom brush by using a WriteableBitmap: http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap(v=vs.95).aspx
This way, you have complete control on how to render your background, then you can assign it to a single Image control. But it's way more complicated than the "use a grid with 9 image controls" method, and the performance improvement is probably insignificant.
How do you find the screen position of a control in silverlight on WP7?
Any suggestions are much appreciated.
If you know how it's positioned (eg in a Canvas) there may be a more appropriate way to do things, but in general, you can use UIElement.TransformToVisual to convert between the control's and the global coordinate system:
var transform = myControl.TransformToVisual(Application.Current.RootVisual)
var offset = transform.Transform(new Point(0,0))
Be sure that the control has undergone layout before trying to do this, if you do it too early the error messages are generally unhelpful.
(MSDN suggests the method is present in WP7, I don't have the SDK installed to test)
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.
With visual styles, i can use
VisualStyleElement.TreeView.Glyph.Closed
and VisualStyleRenderer to draw [+] button like in TreeView.
But when user have a "Classic" style in Windows, visual styles are not supported and I still need to draw this glyph.
It is still possible to use classes like
System.Windows.Forms.CheckBoxRenderer
but I haven't found anything like this for TreeView glyphs.
Yes, it is not possible to get that glyph. It is a simple one but you have to write the code. DrawRectangle and DrawLine. Or use a bitmap. Or make it look like the simple Vista triangles. Or don't enable ownerdraw when visual styles are off.