Q:

Alphabetically Sort Grid Items

I have this Stackpanel with a Grid, and in the grid a multiple amount of buttons which contain content to display. The items are alphabetically ordered, and I have do this manually. For example if the name of a game would be "Death Row", I would have to waste time manually moving every item down one so I could make room for the new item. The question here would be, is there a way to organize it so that I could just implement code inbetween to items and it would automatically adjust?
How the code looks:
Code
Example Image

A:

Don't use a DataGrid to Layout dynamic content, rather use an ItemsControl with DataTemplates and store you data in a collection in a ViewModel and then use databinding to display your content.  This will allow you to change your data collection and have your UI update appropriately.
Example:
A simple class to hold the details of each game:
public class GameViewModel
{
    public string Name { get; set; }
    public string ImagePath { get; set; }
}

Your main ViewModel:
public class SortedContentViewModel
{
    public ObservableCollection<GameViewModel> GameList { get; set; }

    public SortedContentViewModel()
    {
        GameList = new ObservableCollection<GameViewModel>()
        {
            new GameViewModel() {Name="Brink", ImagePath = @"Resources/brink.png" },
            new GameViewModel() {Name="Bulletstorm", ImagePath = @"Resources/bulletstorm.png" }
        };
    }
}

and your XAML:
<UserControl x:Class="Wpf_Playground.Views.SortedContentView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:vm="clr-namespace:Wpf_Playground.ViewModels"
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300"
         DataContext="{DynamicResource ViewModel}">
<UserControl.Resources>
    <vm:SortedContentViewModel x:Key="ViewModel" />

    <DataTemplate DataType="{x:Type vm:GameViewModel}">
        <Button>
            <Grid>
                <Image Source="{Binding ImagePath}" Stretch="Fill" />
                <Border Background="#66000000" Height="30" VerticalAlignment="Bottom">
                    <TextBlock Text="{Binding Name}" Margin="10,-2,10,0" VerticalAlignment="Bottom" />
                </Border>
            </Grid>
        </Button>
    </DataTemplate>
</UserControl.Resources>
    <Grid>
        <ItemsControl ItemsSource="{Binding GameList}" >
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
    </ItemsControl>

    </Grid>
</UserControl>

