TextWrapping, TextTrimming, Center Aligned and vertically stretching

I have a seemingly simple layout problem in Windows Phone. The problem is illustrated in the image below:

My requirements are as follows:

  • Subtitle must always be visible, at the expense of the overflowing text of the title.
  • Title and subtitle together must be vertically and horizontally centered.

When I use a StackPanel or auto-height Grid rows, the box will overflow. If I try star height rows I can't control a large title.

Answers


<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
   <Grid.RowDefinitions>
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
   </Grid.RowDefinitions>
   <TextBlock ...>Title</TextBlock>
   <TextBlock Grid.Row="1" ...>SubTitle</TextBlock>
</Grid>

Found the solution, this will cover everything except the bottom element overflowing the whole screen, in my case this won't be possible. It only works if the parent container does not have infinite height provided (like a StackPanel).

Basically, auto height takes 'precedence' over star-height elements. This gives the bottom TextBlock room to choose its height, and then assigns the remaining available space to the top element.


Need Your Help

Android youtube video playing

android youtube

I want to play Youtube videos in my application. I saw several examples for this.

Compile std::regex_iterator with gcc

c++ regex linker g++ c++11

I can create .o file with g++ -c test.cpp -std=c++0x, but cant link it, got next errors:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.