How can I add padding to my chart? - silverlight

As you can see from below my LineSeries chart (Silverlight Toolkit) utilize the whole area. How can I add a padding to it? So that the line does not stop/end/start at the border. For as you can see from the label it gets overlapped with the border, making it look less nice.

Why don't you increase the axis? Like: Vertical axis goes from 1000 to 9000 - and horizontal axis goes from 30.07 up to 08.08.
And: If you want to set margins to the whole control - doesn't margins / padding work for you?

Related

WPF - Create a border with line style as a saw-tooth (gear)

I need to draw a border or rectangle like a bill payment on shop.
For make it's as real, I need to draw a shredding effect with the bottom is a saw-tooth line instead of a normal border.
Would you please to give me some advises?
Forget borders. Terminate the bottom side of the white area as a normal rectangle, but stack immediately at bottom an image (e.g. PNG) with the perforation strip.
That's the easiest way, unless you need something that adapts to the rectangle's width.

ApplicationBar Edge or Border

I have a pretty standard application with a bar at the bottom. The bar and app are the same background color. My issue is that there is a tiny little line along the edge of the application bar, I can only determine that is it some sort of soft edge that is part of the default style of the ApplicationBar.
Here is an image of the display, note the tiny 1-2 pixel horizontal line:
It appears to be a 1-2 pixel black line with transparency. My main question is, what is this line, is it something I am introducing by accident?
It is by design a 1 pixel gap will be there between ApplicationBar and your ContentGrid. The gap will be visible only when your set the Opacity of the ApplicationBar to 1, So to get rid of the gap You can change the Opacity of the ApplicationBar to 0.99, so that the appbar comes above your ContentGrid.
Obviously you need to make some changes to your ContentGrid so that you can access the part of the Grid that the appbar is occupying.If your grid has ScrollViewer or ListView, it is always recommended to have some extra space after its contents*(may be a empty StackPanel with some height)* which will obviously solve this otherwise if it is a Static layout, you can make use of margin Property.

How to get Silverlight's bitmapimage pixel height before it is drawn to canvas?

I have an Image, which I need to scale based on the image's pixel values.
When I create the bitmapImage, the pixels (height and width) are both 0.
Is there a way to get height and width before the image is drawn to the canvas?
I had a similar issue where I needed to measure the height of a row (with content) being added to a Grid before adding it to the Grid. Short answer - it can't be done.
Long answer - it can be done. In my code-behind, I created a dummy Grid not a part of the UI. I would add the row to it, and then call .Measure on the dummy Grid that would give me the rendered size of the row. Then I could just add the row to the actual Grid on the UI.
I suspect you could try the same approach with your image. Create a dummy Canvas, add the image to the Canvas, and see how big it is.

WPF Clipping Problem

I have a UserControl which has a quadratic Image as a Child. This Image is at the bottom of the UserControl, and half of it is clipped (e.g. the Control's Height is 400, Image's height is 200 and it is set to y=300).
Now, When I rotate the Image, it is still clipped like the way it was first. Like when rotating around 90 degrees, I suddenly have an Image which is only 100px wide.
It seems like the original clipping which was made because of the bounds of the UserControl, are applied forever.
How do I solve this problem? I hope I explained my problem understandable ;)
How are you rotating the image? If you are rotating using a RenderTransform, then WPF does not re-render what was already displayed on the screen - it simply rotates the pixels.
Instead, rotate the image using a LayoutTransform; this forces WPF to re-render the control given the new area it occupies, which should eliminate the clipping you see.
You can also call InvalidateMeasure() after applying render transform.

Silverlight Toolkit Charting Control - Show "Column" Colours

In the silverlight toolkit chart control, the legend on the X Axis can show an indeterminate amount of points. E.g. 1,2,3,4,5.
Would it be possible to colour the virtual columns that this creates? I.e. in the space where legend mark 2 is shown, the space above to the top of the control is shaded to a different colour. This will make it interesting as as the chart scales, the legends on the X Axis change with the size available.
This is mainly for a series of type ScatterSeries for my specific example but could extend to a series of LineSeries.
Hope this explains my requirements.
It's not really possible due to the fact that there are no virtual columns created.
The chart is a canvas and the scatter point is just a point positioned on it. Your best bet would be to create your own ColumnSeries type and then style it to look like a ScatterSeries with your desired background colour.

Resources