I would like to use Anonymous Pro font in a Windows RT application. I was trying to follow the steps from this thread, but without any success.
This is my try:
<TextBlock Text="{Binding Title}" HorizontalAlignment="Center" FontSize="56"
FontFamily="/Assets/Fonts/Anonymous Pro.ttf"
/>
Instead of Anonymous Pro the default font is used. Actually, it the sample (see the link) the font family is specified, but I'm not sure: should I do it or should not. If I should, which family should be there?
So how to embed custom font in Windows RT application and use it from there?
here you go.. just appened the font name.. blogged about it when i saw you post
http://invokeit.wordpress.com/2012/10/18/embed-use-custom-font-in-windows-8-store-apps-win8dev-winrt/
Related
In Android, it is quite easy to set a image placeholder for development purposes in an imageview.
All one would do is use the tools:src for the placeholder image during development so you could see it in your layout design preview and your actual image you would put into your android:src
. Frequently, you don't set the android:src put would populate that imageview with images that you download off the internet once you connect your app to the net:
<ImageView
android:layout_width="28dp"
android:layout_height="28dp"
android:src=#drawable/activated_icon"
tools:src="#mipmap/white_activated_icon" />
In Xamarin, you have this to display images:
<Image Source="http://lorempixel.com/1920/1080/nature/3" />
Once the app connects, the image is downloaded from the internet and displayed. How do I put in a placeholder image for development purposes (similar to the way you would do it through tools:src in android) so I can see it within the layout design previews?
I'm assuming you want to achieve this with Xamarin Forms, as you referring to XAML in the question title.
Or possibly you are referring to the Xamarin Forms Previewer? In that case, disregard the following answer. You can only use local images in the Previewer as far as I can tell.
Answer in case the question is related to runtime Xamarin Forms
There is no standard option to do this in Xamarin Forms. Take a look at this example suggested by Stephane Delcroix from the Xamarin Forums. The important part of this approach is to stack 2 images on top of each other in a grid. 1 is the placeholder that is placed beneath the image that is being loaded, like this:
var grid = new Grid();
grid.RowDefinitions.Add (new RowDefinition());
grid.Children.Add (image);
grid.Children.Add (placeholderImage);
As an alternative option, WebImage of Xamarin Forms Labs allows an option for a DefaultImage, but I'm not sure if that shows immediately. See this class for the code of the Web Image. Keep in mind that Xamarin Forms Labs is no longer under active maintenance.
Of course you can also write a custom renderer. Maybe based on the Xamarin Forms Labs example.
I use FFImageLoading for this Case.
Just install the Nuget Package and Use the "CachedImage" in XAML.
<ff:CachedImage Source="your url" Placeholder="placeholder while loading"/>
You donĀ“t need to download (and cache) the Image manually then. It will automatically displayed when the download is done.
You can use local files (from Resources or Drawable) and files from HTTP/HTTPS.
I'm developing a UWP application, however I'm not able to find where are the default icons.
Where can I find a list of them?
you can use character map application and select the font as segoe mdl2 assets. All the available icons will be shown. Alternatively in xaml also you can use like below code:
<SymbolIcon Symbol="Sync" Foreground="Red"/>
So I added an image to the project:
image
How can I make it display in the app? sorry I know this is a stupid question, I am new to app dev. I tried to import a image control from the Visual Studio toolbox and hoped there would be some kind of drag and dop kind of thing. the code for the Image control:
<Image x:Name="image" HorizontalAlignment="Left" Height="174" Margin="69,148,0,0" VerticalAlignment="Top" Width="229"/>
<ListView x:Name="listView" HorizontalAlignment="Left" Height="150" Margin="110,172,0,0" VerticalAlignment="Top" Width="165">
<ListView.Background>
<ImageBrush Stretch="Fill" ImageSource="Mobile Applications\Logo\logo.png"/>
</ListView.Background>
</ListView>
I am using Visual Basics to develop the app.
I have got no idea why you are using a ListView to display an image however in order to display an image using the "Image" tool, you need to set the source via XAML like this
<Image x:Name="image" HorizontalAlignment="Left" Height="183" Margin="154,55,0,0" VerticalAlignment="Top" Width="96" Source="Images\Man.png"/>
Please note, I created a folder called "Images"
Of course there are others ways to add an image without XAML, but this is a good starting point for you I think.
P.S you will need to drag the "Image" Tool to your application, also i tried this using Windows Phone, it maybe different depending on what Framework you are using, but shouldn't be too hard to work out.
Happy Coding!
I want to change the background image on Windows Phone 8 app. The following code does not work:
<phone:Panorama.Background>
<ImageBrush ImageSource="/PanoramaAppTest;component/Assets/background.png"/>
</phone:Panorama.Background>
You should try your image source. Like this;
<phone:Panorama.Background>
<ImageBrush ImageSource="/Assets/background.png"/>
or
<phone:Panorama.Background>
<ImageBrush ImageSource="../Assets/background.png"/>
</phone:Panorama.Background>
Actually I don't know but your problem's is location name.
Why is this not working :-
<toolkit:Accordion x:Name="___No_Name_" Margin="0" SelectionMode="OneOrMore" HorizontalAlignment="Stretch" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=grid}"
>
<toolkit:AccordionItem Header="Welcome" Margin="10,0" IsSelected="True" >
<TextBlock Margin="3" TextWrapping="Wrap" Text="This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone " FontFamily="Verdana" FontSize="13.333" Foreground="#FF033C68"/>
</toolkit:AccordionItem>
<toolkit:AccordionItem Header="Family news" Margin="10,0" />
<toolkit:AccordionItem Header="Random photos" Margin="10,0" />
<toolkit:AccordionItem Header="News articles" Margin="10,0" />
</toolkit:Accordion>
I can only see the 1st line. The rest of the content is clipped. Why is the height not automatically setting it up even though i have a wrap on textblock? Why is this control harassing me so much? What wrong am i doing? Why can't i get the normal expected behavior with this control?
Even this simplest possible markup doesn't work.
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" x:Class="SilverlightApplication3.MainPage"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<toolkit:Accordion HorizontalAlignment="Stretch" Margin="0">
<toolkit:AccordionItem Header="Header">
<TextBlock Text="This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a " TextWrapping="Wrap"/>
</toolkit:AccordionItem>
</toolkit:Accordion>
</Grid>
</UserControl>
The text in a TextBlock won't wrap unless the TextBlock also has a Width set.
I took your 'simplest possible markup', added Width=1000 to the TextBlock and the text wrapped as I expected it to.