How do I change the legend label of a pie chart to a square. I looked at the example code but it does not change the label to a square for me.
<RadCartesianChart height="300">
<CategoricalAxis tkCartesianVerticalAxis></CategoricalAxis>
<LinearAxis tkCartesianHorizontalAxis></LinearAxis>
<BarSeries tkCartesianSeries
[showLabels]="true"
[items]="sampleData"
categoryProperty="name"
valueProperty="value">
<PointLabelStyle tkBarLabelStyle
margin="10"
textSize="10"></PointLabelStyle>
</BarSeries>
</RadCartesianChart>
I don't think such customisation is supported, by default it seems to be square in Android and circle in iOS.
You might have to raise a feature request if you like that option.
Related
Is it good to use margin/padding to align the position of CachedImage in XAML Xamarin Forms? Or any other preferable/good way to align it so that it can stay consistant to all devices screens?
Like for example:
There are plenty of options, which to use will depend on the rest of your layout. Anyway, increasing the transparent area of the image will not port very well, because of different screen-sizes and -ratios.
Learn about layouts in Xamarin.Forms, it will help you much. On way to center (or otherways align) an image would be to use an AbsoluteLayout (see here)
<AbsoluteLayout HorizontalOptions="Fill" VerticalOptions="Fill">
<Image Source="whatever.png"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds=".5,.5,-1,-1" />
</AbsoluteLayout>
AbsoluteLayout.LayoutBounds=".5,.5,-1,-1" sets the position of the Image to centered, while the size is retained.
When displaying datepicker in XAML page bottom borderline color is black. I want to change this color to white. How to solve this problem. Is there any custom renderer to set the bottom borderline color. I am using absolute layout in my XAML page. By default when displaying datepicker on my page the date with black bottom borderline color. I just want to change to white color.
I posted an answer yesterday for another user who wanted to change the bottom line color of a text view. You can most likely do it the same way with a custom DatePicker; simply change the background to the xml resource in your custom renderer.
See here:
How can i change editor bottom border line color using custom renderer in xamarin forms
Just change the color values in the XML code to color="white".
You have to create an XML file in drawable folder and add this styling. You can customize it according to the color you want.
Add this file to style of datepicker, Resource.Style.datepicker.
<style name="datepicker" parent="Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">#color/clrDatePrimary</item>
<item name="colorPrimaryDark">#color/clrDatePrimaryDark</item>
<item name="colorAccent">#color/clrDateAccent</item>
</style>
Good day, I want to have my canvas have rounded corners. i know you place the canvas inside a Border Tag and round from there like
<Border>
<Canvas>
</Canvas>
</Border>
Now the solutions i have seen, they have an element in their Xaml called ClipToBounds Which makes the canvas adjust to the border but it is not present for SilverLight. so is there a way i can have this feature or an alternative so that the Canvas clips correctly to the Border? Thanks in Advance.
P.S i know i can set the canvas to transparent and the border background to the background i want the canvas to take, but am still learning windows phone so am trying to know as much solutions as possible in case that always doesn't work. Thank you
You can use Canvas.Clip:
<Canvas Height="100" Width="100" Background="white">
<Canvas.Clip>
<EllipseGeometry Center="50, 50" RadiusX="68" RadiusY="68" />
</Canvas.Clip>
</Canvas>
Also, here's a handy tutorial if you wish to define your own ClipToBounds behaviour:
http://www.codeproject.com/Articles/36495/Silverlight-ClipToBounds-Can-I-Clip-It-Yes-You-Can
I need to create a slider with two colors, so that when you slide one direction or the other it appears as though one color has a higher percent over the other, or vice versa. However, when I apply the code below, wp7 automatically dims the background color, so it's not the proper color. The slider is in a list box which iterates over objects, so the colors are constantly changing. Any way to make the color of the foreground match the color of the background? (so that #ffffff would appear white on both sides of the slider, and not white on one and a gray on the other?)
Code is below.
<Slider
Grid.Column="0"
Grid.ColumnSpan="3"
Grid.Row="1"
Background="{Binding AwayTeam.Color}"
Foreground="{Binding HomeTeam.Color}"
FlowDirection=""
Value="4.7"
/>
Ok, so I'm adding some clarification. Look at the picture at this link. Slider Example
The bottom background (right hand side) is what I need the slider to look like, and that blue is what the color is supposed to look like. But, when I set that blue as the background color, wp7 makes it darker. The top slider is what wp7 currently does to the background color, and the bottom is what I need the background color to look like.
You just need to make a minor modification to the sliders template:
Open the project in Expression Blend.
Select the slider in the "Objects and Timeline" window.
Right click on it and select: Edit Template > Edit a copy
In the xaml for the template, find this line
<Rectangle x:Name="HorizontalTrack" Grid.Column="2" Fill="{TemplateBinding Background}"
Height="12" IsHitTestVisible="False" Margin="0,22,0,50" Opacity="0.2"/>
remove Opacity="0.2"
Accept this answer. :)
I have a main page with 2 canvas like this:
<Canvas Name="main_canvas_color" Width="480" Height="800" Background="White" HorizontalAlignment="Center" VerticalAlignment="Center">
<Canvas Name="main_canvas_image" Width="480" Height="800" HorizontalAlignment="Center" VerticalAlignment="Center">
</Canvas>
</Canvas>
the first one is filled by color the other one is filled by image. In PhoneApplicationPage_OrientationChanged event a swap width and height for both canvas. If i rotate a screen, it works fine, everything positioned correctly. If I add a Border element as a children to main_canvas_image and then rotate screen, main_canvas_image is not updated in a right way, it is shifted toward top right corner. If I open any another page and then go back after that, main_canvas_image is updated properly. So it seems that i have to force layout update, but i don't know how to do that. I tried UpdateLayout(); inside PhoneApplicationPage_OrientationChanged event, but it does not work. How can I update canvas layout in a right way?
Why bother ? The phone automatically adjust the size when you change the orientation. No reason to write code for it yourself.