I'm new to windows phone dev. My team used syncfusion for the dropdown treenavigator. I've tried tweaking the colors, margins and padding but wasn't able to change the FontSize. Any tips?
<sfnavigation: sfTreeNavigator>
<sfnavigation:sfTreeNavigatorItem FontSize="5"/>
</sfnavigation:sfTreeNavigator>
Sorry, my laptop crashed and I couldn't remember the setter syntax but yeah tried in that too. It won't update.
Can you check the sample which i have attached? I'm able to change the FontSize for SfTreeNavigatorItem.
Sample
Code which i have used are
<Style TargetType="navigation:SfTreeNavigatorItem">
<Setter Property="FontSize" Value="10"/>
</Style>
Regards,
Jegan Raj M
Related
As pointed out in this documentation -
https://developer.xamarin.com/guides/xamarin-forms/creating-mobile-apps-xamarin-forms/summaries/chapter05/, specifying a height of 1 will give you 1, 2 or 3 pixels depending on the iOS device.
I want to put a separator into my view similar to a hr in HTML. I've done this by adding either a BoxView or StackLayout with a height of 1 and the necessary width.
This means that depending on the device, the separator will not always render at 1px. Is there something I can do to ensure that I will always get 1px for any device?
At the moment all I can think of is to place my content into ListView cells and leverage the native separators provided.
I think you are interpreting it wrong. Although you might actually get 1, 2 or 3 pixels, the user will see the same thing. This is due to the retina screens. Density will be higher, but the end result will be the same.
This is the same reason that you need to supply all images with the #2x and #3x suffix. The images will physically be bigger, but on iOS they will appear the same.
Following similar steps to the answer here https://stackoverflow.com/a/26570933/2931055 I ended up defining a global style that uses a static variable set up in the startup of iOS and Android, then defined in my stylekit to programmatically determine the fraction of a point I need for any given device.
In my portable project App.xaml.cs I defined
public static double ScreenDensity { get; set; }
Which needs to get populated independently for iOS and Android.
For iOS, in AppDelegate.cs in FinishedLaunching()
App.ScreenDensity = UIScreen.MainScreen.Scale;
Then for Android, in MainActivity.cs in OnCreate()
App.ScreenDensity = Resources.DisplayMetrics.Density;
UIScreen.MainScreen.Scale and Resources.DisplayMetrics.Density will evaluate to 1.0, 2.0 or 3.0 depending on the device.
In my portable project StyleKit (myApp\Helpers\StyleKit\SytyleKit.cs) I created a static variable to later use in a global style
using Xamarin.Forms;
namespace myApp.Helpers.StyleKit
{
public class Sizes
{
public static double Hairline = 1 / App.ScreenDensity;
}
}
Then in my global styles (myApp\App.xaml) I create the global style
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="myApp.App"
xmlns:stylekit="clr-myApp.Helpers.StyleKit;assembly=myApp">
<Application.Resources>
<ResourceDictionary>
<Style x:Key="hairlineSeparator" TargetType="StackLayout">
<Setter Property="BackgroundColor" Value="#ddd" />
<Setter Property="HeightRequest" Value="{x:Static stylekit:Sizes.Hairline}" />
<Setter Property="HorizontalOptions" Value="FillAndExpand" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
And finally when I want to use one in a xaml page
<!-- some content -->
<StackLayout Style="{StaticResource hairlineSeparator}"></StackLayout>
<!-- some content -->
Successfully tested on iOS and Android.
I've working on a project where in a page I'm having a ListBox and every ListBoxItem is an ExpanderView control... everything is working ok, but I'm having problems setting the ExpanderView header to have the maximum width (100% of the available space). I've set
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
on my ListBoxItem, but without any success...
The ExpanderView header template is using a grid view which has 1 row and 2 columns (first should have * width, second should have 100)... so far the first column expands based on the content width and doesn't stretch if needed.
Any idea how I could implement this?
Thank you in advance!
Andrei
Hello,
I have used chart control in my application. I have bound Date as IndependentValueBinding (X Axis). All code is working fine but date is display horizontal So if I have many value I dont find the perfect value related to date as there are many date in X axis. So How can I display Date as Vertical on X axis.
<chart:BarSeries
IndependentValueBinding="{Binding Date}"
DependentValueBinding="{Binding Price}"/>
<chart:Chart.LegendStyle>
<Style TargetType="datavisual:Legend">
<Setter Property="Width" Value="0"/>
<Setter Property="Height" Value="0"/>
</Style>
</chart:Chart.LegendStyle>
</chart:Chart>
Thanks,
Hitesh
You will need to set the style for AxisLabelStyle, I think WP version of charts should be the same as Silverlight:
How to: Easily rotate the axis labels of a Silverlight/WPF Toolkit chart
I am trying to create icons in Microsoft Expression Design, but I want to add the system resource colors like the phone background and foreground so that the icons change color when the user changes the theme. Does anyone know how to specify the windows phone system colors in Expression Design, or how to import them?
Thanks
This is a great blog post that I've used before which goes step-by-step into applying the System themes into images (which should be white.. but It'll get into the nitty-gritty details!)
Using an image as a mask so that WP7 theme’s are honoured
For example, here's how you can do it using a Rectangle and OpacityMask:
<Rectangle Fill="Black" Height="48" Width="48">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="/MyProject;component/Images/Dark/appbar.add.rest.png" />
</Rectangle.OpacityMask>
</Rectangle>
Note that the Height & Width are set explicitly to the Width & Height of my ImageSource. This fixes the stretching issue that will occur if you don't do this.
Hi in my application i displaying the news details. It contains template(hedaline, said by and story). I need to set the foreground of the each textblock as "White" irrespective of the theme color change. Is there any common plalce set the foreground color so it will affect whole page.
Please help me , dont tell me to set the foreground to all textblocks.
Define a Style (without a x:Key) for a TextBlock and it'll automatically affect all TextBlock in your application.
If you want it only affects the whole page, add a Foreground color to the page like this,
<phone:PhoneApplicationPage Foreground="{StaticResource PhoneAccentBrush}" ...
Please note that if you apply any style to your TextBlocks on this page, this color (in this case PhoneAccentBrush) will be overwritten by the color defined in the TextBlock's style.
you can refer to this link http://innovativesingapore.com/2010/08/experession_phone/ for creating style as follows
<phone:PhoneApplicationPage.Resources>
<Style x:Key="MyStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="White"/>
</Style>
</phone:PhoneApplicationPage.Resources>
And apply to the Text blocks as
<TextBlock Height="49" Name="textblock" Margin="67,49,0,0" Text="WhiteForegroundText" Style="{StaticResource MyStyle}" />