I need to draw doughnut chart under .net 4.0 but i cannot find any useful library. Metro ui and other need only .net 4.5. I do not want to make custom control. Can you suggest some library?
Easy with Live Charts https://github.com/beto-rodriguez/Live-Charts
it is a new library I started because alternatives right now were not what I needed, maybe it helps you too
<liveCharts:PieChart Name="Chart" Grid.Row="1" Grid.Column="0">
<liveCharts:PieChart.Series>
<liveCharts:PieSeries Title="Maria" PrimaryValues="15, 10, 40, 55"
Labels="Day 1, Day 2, Day 3, Day 4"></liveCharts:PieSeries>
</liveCharts:PieChart.Series>
<liveCharts:PieChart.PrimaryAxis>
<liveCharts:Axis Title="Sold Items"></liveCharts:Axis>
</liveCharts:PieChart.PrimaryAxis>
</liveCharts:PieChart>
Related
I'm not able to get crisp icons in a WPF project. I've tried several solutions but the results are terrible when the icons are downscaled. The starting files are .ai (Illustrator) that I've exported to xaml code using Expression Design
Here is an example
blurry icons example
First of all, you can try to play with properties SnapsToDevicePixels and UseLayoutRounding.
Next, please check what coordinates your vector images use. In order to get the sharp lines, you must either move your coordinate system to (0.5, 0.5) or use half-integer coordinates (e.g. 0.5, 2.5, 11.5).
Please, have a look at this MSDN topic.
There is also a perfect article on this topic. It's in Russian, but you can try to use Google Translate for it.
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..
I have to mention first that I have never worked with silverlight before.
I'm currently starting a project and I need to work with DrawingBrush... to resolve this task
I'm developing in visual studio 2012 and sometimes in 2010, the project is Silverlight5
This is the context where I need DrawingBrush
<Image Source="Images/image.png">
<Image.OpacityMask>
<DrawingBrush>
...
</DrawingBrush>
</Image.OpacityMask>
</Image>
The problem is I can't find use DrawingBrush... it doesn't find it's reference. Intellisense says:
"The type or namespace name 'DrawingBrush' does not exist in the namespace 'System.Windows.Media' (are you missing an assembly reference?)"
Do I have to include something or add a certain reference to my project to use DrawingBrush?
Thanks!
I suggest you to do it in different way.
Convert this image into WriteableBitmap (pixel information) as WB1.
Take another WriteableBitmap as WB2 of same size field with Black color pixel.
Render WB2 as image. Now whenever required you can copy specific pixels from WB1 to WB2 and display the modified WB2.
The following project/sample code will help you to learn to work with WritableBitmap. You just need to learn the following things from this project.
How to read pixel information from an image.
How to modify those pixels information
and how to display the modified pixels
information as Image
Sample Code: http://code.msdn.microsoft.com/CSSL3WriteableBitmap-960deef6
This project supports Silverlight 3. So definitely it will be supported in Silverlight 5.
Hope this helps!
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.
I'm looking for a WPF Gradient Picker example and source code.
The goal is to allow the user of a WPF application to pick the gradient brush to use for a background or foreground. I've seen pickers in Blend (too confusing for a casual user) and Photo Shop. I'm looking for a WPF implementation of something along the line of the Photo Shop picker implemented as a WPF dialog box.
Any pointers to good examples much appreciated.
Thanks.
Found it, this one too on the CodeProject: .Net Protoshop-like gradient picker. Enjoy ;)
Random gradient wallpaper generator. closest thing I could find... unfortunately it only has four possible gradient stops, one in each corner... worth looking at the code perhaps, and getting a few tips...
It seems like something that would be pretty easy to code, in terms of a custom control.
Just have a canvas that you change the background of, with some other controls for changing the colour and the stop points.