Why is FontSize in XAML not working for me? - xaml

This is the relevant part of my code:
<Viewbox Grid.Row="3">
<StackPanel>
<TextBlock Text="Email: email#idk.com" FontSize="60"></TextBlock>
<TextBlock Text="Phone number: 000-111-2222" FontSize="60"></TextBlock>
</StackPanel>
</Viewbox>
No matter which number I put in the FontSize field, it doesn't affect the image at all. What am I doing wrong?
(StackOverflow won't let me upload a picture of the image being presented because of a server error).

Related

Screen does not display full content of string

i'm using the textblock to display the content,but for the long content, it just cut off and not display the content fully while i'm sure that the i filled the content string. Pls show me where my code is wrong. Thanks
Link of the my screen: www.flickr.com/photos/37903269#N05/15332152972/
my xaml code :
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<!-- <phone:WebBrowser VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Name="webBrowser1" /> -->
<ListBox Name="Listbox_DetailPage">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Content}"
TextWrapping="Wrap"
Style="{StaticResource PhoneTextNormalStyle}"
HorizontalAlignment="Center"
/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
I executed the code shared and it seems to wrap text as shown in the screen shot below.
The screenshot you shared seems to have vertical cropping of the text as well. For that, we can set the ScrollViewer.VerticalScrollBarVisibility to 'Auto' with proper Height given.
Also, for your additional knowledge or may be future use, here are some stackoverflow questions which explains the text 'NOT WRAPPING' issue for StackPanel
TextBlock TextWrapping not wrapping inside StackPanel
TextBlock TextWrapping not wrapping
actually, i fixed it.Because of the limitation of sing UI: 4096px limit of size. So there is a need to split the long content in the more than one TextBlock or you can create a scrollabe textbock as here

Doesnt show the full article

I have some long article to show in an view. So I made a TextBlock and bound Text with Content property.
Xaml:
<Grid Margin="12,24,12,0"
Background="White">
<TextBlock FontSize="{StaticResource PhoneFontSizeExtraLarge}"
FontFamily="{StaticResource PhoneFontFamilySemiLight}"
Foreground="Black"
Text="{Binding Column.Title}"
TextWrapping="Wrap"
Margin="0,0,0,12"
VerticalAlignment="Top" />
<ScrollViewer Margin="0,62,0,10">
<TextBlock FontSize="{StaticResource PhoneFontSizeMediumLarge}"
Text="{Binding Column.Content}"
TextWrapping="Wrap" />
</ScrollViewer>
</Grid>
The last paragrafs of the article:
The problem is that it doesn’t show the last paragraphs O_o:
What is the problem and how can I fix it?
The reason for this behavior is that any element that must be displayed beyond the area which is larger than 2048x2048 pixels would be clipped by the platform.
Maybe this article can help you : Creating Scrollable TextBlock for WP7.

RotateTransform applies after Image has been displayed and this causing blinking

I have such DataTemplate:
<DataTemplate x:Name="GreenMarkTemplate">
<Grid Width="64" Height="64">
<Image Source="Assets/Marks/mark_green.png" RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<RotateTransform CenterX="0.5" CenterY="0.5" Angle="{Binding course}" />
</Image.RenderTransform>
</Image>
<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding route_num}" VerticalAlignment="Center" FontSize="16"/>
</Grid>
</DataTemplate>
And I need to rotate Image according to "course" property. At first, Image shows with zero angle and in a moment it rotates. This makes Image blinking.
So, is it possible somehow to make Image invisible and show it only after rotation? or rotate image before rendering it?
Resolved the issue using LayoutTransform port for Windows Phone 8. github link

Windows 8 Metro XAML. How to change background of grid on hover and/or click

I would like to change the background of my grid to white when you hover over or select it. I'd also like to change the color of the text inside at the same time to black. This is specific to one page only, so it would need to be applied with an XKey or something as a guess. The grid starts with a transparent background, also.
I'm really struggling to find the direction for this. Please let me know if you have any ideas or links!
Here's my code:
<GridView.ItemTemplate>
<DataTemplate>
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" Width="335" Height="152">
<StackPanel Orientation="Horizontal" Margin="2,2,2,2" VerticalAlignment="Top" HorizontalAlignment="Left">
<StackPanel Margin="13,0,13,0" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
<TextBlock Style="{StaticResource SmallText}" Text="{Binding Town}" />
<TextBlock Style="{StaticResource SmallText}" Text=", "/>
<TextBlock Style="{StaticResource SmallText}" Text="{Binding State}"/>
<TextBlock Style="{StaticResource SmallText}" Text=", "/>
<TextBlock Style="{StaticResource SmallText}" Text="{Binding Postcode}"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
Thanks for any help.
It seems like you would probably want to modify your GridView's ItemContainerStyle and change its background and visual states to match your requirements. Check my answer to an earlier question related to restyling items here to learn how to extract and modify these styles and templates.

Binding Hyperlink to richtextblock in windows 8 Metro app

I am building a windows 8 metro app for fun/learning etc.
I have created a listview of text items that have descriptions, images etc. Inside the description, there are often hyperlinks that I would like to make clickable.
However, when binding to a textblock, xaml hyperlink code is displayed as text. Searching arround, it looks like I need to use a richtextblock for hyperlinks. I can't seem to figure out how to bind a hyperlink to it. I have found many examples from wpf showing how to extend the richtextblock using flowdocument. Flowdocument doesn't exist in the current consumer preview version of the framework.
I am reaching out to see if anyone has solved this issue or has any suggestions on what path to head down.
Edit:
Code I have Currently
right now I am just binding the "text" field from my Statuses Object to a textblock binding on "text"
I have URL's in the text field which I want to be able to make clickable.
As a test I was replacing the text field of the first object with hyperlink markup
ex.
feed_results[0].text = "<hyperlink .....
then trying to bind to texblock and richtextblock
Xaml
<ListView x:Name="ItemListView" ItemsSource="{Binding}" Background="Black" Width="372" VerticalAlignment="Top" Margin="50,0,0,0">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" MinHeight="100">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding user.profile_image_url}" Margin="0,0,15,0" VerticalAlignment="Top" />
<StackPanel Orientation="Vertical">
<TextBlock HorizontalAlignment="Left" Foreground="Gray" Text="{Binding user.name}" FontWeight="Bold" TextWrapping="Wrap" MaxWidth="200" />
<TextBlock HorizontalAlignment="Left" Foreground="Gray" Text="{Binding text}" TextWrapping="Wrap" MaxWidth="200" />
</StackPanel>
</StackPanel>
<StackPanel Margin="0,15,0,0" HorizontalAlignment="Right">
<TextBlock Text="{Binding created_at, Converter={StaticResource StringConverter},ConverterParameter=Released: \{0:d\}}" HorizontalAlignment="Center" Foreground="Gray" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
Backend Code
FeedResult<Statuses> r2 = await feed.StatusesAsync(1, 50);
if (!r2.HasError)
{
feed_results = r2.Result;
Dispatcher.Invoke(Windows.UI.Core.CoreDispatcherPriority.High, new Windows.UI.Core.InvokedHandler((o, a) =>
{
ItemListView1.ItemsSource = feed_results;
}), this, null);
}
Microsoft removed support for inline hyperlinks from Metro XAML. You can still use HyperlinkButton for non inline hyperlinks, or if your inline hyperlinks short (1-2 words) then you could place HyperlinkButton inside of InlineUIContainer in RichTextBlock. Later solution would require some code, just using binding won't do it.