Если вы поместите все ваши ControlTemplates в словарь ресурсов, вы можете использовать конвертер для шаблона, как это
<ComboBox Height="52" HorizontalAlignment="Left"
ItemsSource="{Binding templatesNames}"
SelectedValuePath="Type.FullName"
Margin="169,43,0,0" Name="comboBox1"
VerticalAlignment="Top" Width="148" />
<Button Content="Button"
Template="{Binding SelectedItem.Value,
ElementName=comboBox1,
Converter={StaticResource TemplateConverter}}"
Height="56" HorizontalAlignment="Left"
Margin="191,204,0,0" Name="button1"
VerticalAlignment="Top" Width="80" />
И в Converter вы загружаете ControlTemplate из словаря ресурсов и возвращаете его.
public class TemplateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string resourceKey = value.ToString();
Uri resourceLocater = new Uri("/YourNamespace;component/Dictionary1.xaml", System.UriKind.Relative);
ResourceDictionary resourceDictionary = (ResourceDictionary)Application.LoadComponent(resourceLocater);
return resourceDictionary[resourceKey] as ControlTemplate;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
Обновление
Если ваше пространство имен - dinamicGridLayout, то конвертер должен выглядеть следующим образом
Uri resourceLocater = new Uri("/dinamicGridLayout;component/Dictionary1.xaml", System.UriKind.Relative);
Загружен небольшой пример проекта здесь .