Windows 8 Image UniformFill centered

I managed to solve my problem, I made the image larger than the container it was placed in and vertical aligned it in the center. <Grid HorizontalAlignment=”Left” Width=”250″ Height=”125″> <Image Source=”/url/to/image.jpg” Stretch=”UniformToFill” Height=”250″ Margin=”0″ VerticalAlignment=”Center”/> </Grid> The overflow of the image was invisible 🙂

Why can’t I comment attributes in XAML?

Though you can’t comment out using the basic XAML markup, you can achieve the desired results by importing the Open XML markup namespace. xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″ xmlns:ignore=”http://www.galasoft.ch/ignore” mc:Ignorable=”ignore” <Label x:Name=”Gaga” FontSize=”20″ ignore:Content=”{Binding SomethingThatIsEmptyAtDesignTime}” Content=”LookAtMe!” /> This blog post describes how to do it.

Unknown Build Error ‘key cannot be null’

We are working on this project in a team and I just copied the line for using resources… I just forgot to copy the xmlns attribute as well. What I find strange is that the error isn’t really descriptive and doesn’t give any real hints as to what the problem is. Moral of the story: … Read more

Maximum number of lines for a Wrap TextBlock

Update (for UWP) In UWP Apps you don’t need this and can use the TextBlock property MaxLines (see MSDN) Original Answer: If you have a specific LineHeight you can calculate the maximum height for the TextBlock. Example: TextBlock with maximum 3 lines <TextBlock Width=”300″ TextWrapping=”Wrap” TextTrimming=”WordEllipsis” FontSize=”24″ LineStackingStrategy=”BlockLineHeight” LineHeight=”28″ MaxHeight=”84″>YOUR TEXT</TextBlock> This is all that … Read more

Let TextBox stretch to fill width in StackPanel

Unfortunately the alternative (DockPanel) isnt available for Metro. You could try a WrapGrid, but I dont know if it’ll solve your problem (Ive never used it). The only real way of doing this is using a Grid as you described: <Grid Width=”400″> <Grid.ColumnDefinitions> <ColumnDefinition Width=”Auto” /> <ColumnDefinition /> </Grid.ColumnDefinitions> <TextBlock Text=”Label” Width=”150″ /> <TextBox Text=”Value” … Read more

ViewModels in ViewModelLocator MVVM Light

First, lets look at what ViewModelLocator does and why we use it: ViewModelLocator is declared as an object on our App.xaml page and is an application singleton. We’re going to have one, and only one of them available to the application when it runs. ViewModelLocator is the source for all our ViewModels in MVVM Light. … Read more

Xamarin form: How to reference to the parent binding

@qubuss gave the correct answer below, but I would like to give more context and show an example to make it more clear: Lets consider the following page: <ContentPage xmlns=”http://xamarin.com/schemas/2014/forms” xmlns:x=”http://schemas.microsoft.com/winfx/2009/xaml” x:Name=”firstPage” –>this reference parent context x:Class=”Your_Class_Name”> <ListView x:Name=”ListSource” ItemsSource=”{Binding ListSource}” > <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid> // this come from item source <Label Text=”{Binding ABC}”></Label> … Read more

Can percentage values be used in XAML?

Grid ColumnDefinitions and RowDefinitions allow for proportional units (in addition to fixed pixels and Auto). Here are 2 examples: <Grid.ColumnDefinitions> <ColumnDefinition Width=”Auto” /> <ColumnDefinition Width=”20″ /> <ColumnDefinition Width=”*” /> <ColumnDefinition Width=”*”/> <ColumnDefinition Width=”*”/> <ColumnDefinition Width=”*”/> </Grid.ColumnDefinitions> The first column will be as large as necessary to fit all content in the column. The next column … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)