반응형
public class StringFormatConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(targetType == typeof(string) && parameter is string)
return String.Format(culture, parameter as string, value);
return value;
}
}
================ 사용하기 ===================
Text="{Binding ElementName=slider,
Path=Value,
Converter={StaticResource stringFormat},
ConverterParameter='The slider is {0:F2}'}"
반응형
'WINDOWS PHONE' 카테고리의 다른 글
LINQ 문자열 검색 SQL Like 같이 하기 (0) | 2012.07.24 |
---|---|
RelativeSource 사용하기 (0) | 2012.06.28 |
Binding의 속성 Path (0) | 2012.06.28 |
코드로 Binding 하기. (0) | 2012.06.27 |
DataTemplate를 이용한 버튼 예제. (0) | 2012.04.18 |