The answer with an ItemsControl sounds perfect but in case you didn't want to do that you could create a converter that adds a '\n' between each character of text.
The XAML for your Page:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DilbertDownloader" x:Class="DilbertDownloader.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<local:TextVerticalConverter x:Key="TextVerticalConverter"/>
</Window.Resources>
<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>
<Grid>
<Button Content="{Binding ButtonText, Converter={StaticResource TextVerticalConverter}}" HorizontalAlignment="Left" Margin="270,156,0,0" VerticalAlignment="Top" Width="75"/>
</Grid>
</Window>
The code for the converter:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DilbertDownloader
{
public class TextVerticalConverter : System.Windows.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (!(value is string)) return value;
var converted = "";
foreach (var character in (string)value)
{
//If the character is a space, add another new line
//so we get a vertical 'space'
if (character == ' ') {
converted += '\n';
continue;
}
//If there's a character before this one, add a newline before our
//current character
if (!string.IsNullOrEmpty(converted))
converted += "\n";
converted += character;
}
return converted;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
//Not really worried about this at the moment
throw new NotImplementedException();
}
}
}
And the code for the ViewModel
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DilbertDownloader
{
public class ViewModel
{
public string ButtonText { get; set; }
public ViewModel()
{
ButtonText = "BUY";
}
}
}
Hope that's helpful