I am new to XAML. I would like to add additional string to x:bind
I have tried
<AppBarToggleButton Icon="Phone" Label="E-Mail To {x:Bind e_mail}" />
<AppBarToggleButton Icon="Phone" Label="{"E-Mail To" + x:Bind e_mail}" />
I would like to get "E-Mail to email@email.com"
But no success. Thanks for help.
Create a converter for this:
public sealed class StringFormatConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value == null)
return null;
if (parameter == null)
return value;
return string.Format(parameter.ToString(), value);
}
public object ConvertBack(object value, Type targetType, object parameter,
string language)
{
throw new NotImplementedException();
}
}
Add this to yor page/control/app resources:
<converters:StringFormatConverter x:Key="StringFormatConverter" />
And then use it like this:
<TextBlock Text="{x:Bind e_mail}"
Converter="{StaticResource StringFormatConverter}"
ConverterParameter="E-Mail To {0}!" />