Nativescript - vertical align a Label text to the top (iOS) - nativescript

Is it possible to position the text of a Label element at the top on iOS?
The default seems to vertically centered.

You can get it done using -
<Label verticalAlignment="top" text="some text"></Label>

Perhaps use a bit of good old fashioned padding in your CSS? padding: 0 10 20 10 should align the text in the label at the top.

Related

Is it the good way to use Margin/Padding in Xamarin Forms XAML? Or increase the transparent surface of image not using margin and padding?

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.

UWP - Zoom Image and scrollbar

I have write a simple code in XAML for zoom an Image
<Grid Grid.Row="1" Background="AliceBlue" Margin="10,10,10,10" Name="Griglia_Immagine">
<ScrollViewer Name="MyScrollViewer" MinZoomFactor="1" ZoomMode="Enabled">
<Image Name="Imm_Visualizzata" Source="Assets/Test.jpg" >
</ScrollViewer>
</Grid>
When i zoom the image it became more big.
On my right i can see the vertical scrool bar but i don't see the Horizontal one.
So... where the image is big i can move Up-Down ...but if i move left-right the image where i leave my finger the image return on left border.
I'had tried to set HorizontalScrollBarVisibility and VerticalScrollBarVisibility ...
If i set both to Hidden the start image is very big (original format) If i set both to Disabled the zoom not work.
If i set One on Hidden and one on Disabled the zomm work but i can move the image only vertival or horizontal... where i had set the Hidden value..
Anyone had solved it ?
Thanks

Getting Windows 8 UI Control to fill entire horizontal space

For a Windows 8 Metro app, I have a Rectangle inside of a Canvas inside of the main Grid, such that:
<Grid>
...
<Canvas>
<Rectangle />
...
</Canvas>
</Grid>
How would I make the rectangle dynamically take up the width of the screen?
Canvas does not constrain or change its children's size or positions. If you want your rectangle to be as long as the screen width I recommend to put it inside the Grid, as the Grid has the size you need for the Rectangle (with HorizontalAlignment="Strech"). Or you might bind Rectangle.Width to Grid.ActualWidth.

Windows Phone 7 Slider Accent Both Foreground and Background Colors

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. :)

Icons in an Expression Blend tree view

I'm getting settled in with using Expression Blend, and there is one thing I am trying to do that I can not figure out for the life of me.
I want to have a tree where each text item has an icon before the text (trying to create something like a folder tree view). I created a sample data source and each item has two properties. An image and a line of text. the problem is that rather than the icon being before the text, the icon is really big and has a new line before the text. How do I correct this? Thanks for your help!
You can see what I'm getting here: http://imgur.com/daDaz.png
Edit:
The solution I came to involved editing the MainWindow.xaml. I set the property names in the data tab to 'TreeIcon' and 'TreeLabel', then I added an orientation attribute to the stackpanel and changed the icon height/width to something more agreeable:
<StackPanel Orientation="Horizontal">
<Image Source="{Binding TreeIcon}" HorizontalAlignment="Left" Height="24" Width="32"/>
<TextBlock Text="{Binding TreeLabel}"/>
</StackPanel>
Without the 'Orientation' attribute, it defaulted to vertical, so setting it to 'Horizontal' got the icon and text positioned properly. Setting the image height to 24 makes the icon roughly a good size for the text it's next to. The width is set to 32 because when it was at 24, the icon and the text were directly next to each other, with no padding at all. Upping the width to 32 padded some padding to the left.
Is this silverlight or WPF? Have you looked at your style template to find the content controls and see if they're set with a maxheight or maxwidth property and perhaps a stackpanel with Horizontal orientation?

Resources