StringFormat для привязываемого свойства, не отображающего дополнительный текст ⇐ C#
StringFormat для привязываемого свойства, не отображающего дополнительный текст
So I have created a custom control in .net MAUI XAML with Bindable Properties.
For one, I wish to display a % as a suffix after the text on a specific view, but the StringFormat doesn't display it.
My View element
My code
public static readonly BindableProperty PercentProperty = BindableProperty.Create(nameof(Percent), typeof(string), typeof(StatsControl), propertyChanged: (bindable, oldValue, newValue) => { var control = (StatsControl)bindable; control.PercentEntry.Text = newValue as string; }); public string Percent { get => GetValue(PercentProperty) as string; set => SetValue(PercentProperty, value); } The actual value is correctly presented and works OK. But no other text I place in the StringFormat either before or after the value is shown!
Источник: https://stackoverflow.com/questions/780 ... ional-text
So I have created a custom control in .net MAUI XAML with Bindable Properties.
For one, I wish to display a % as a suffix after the text on a specific view, but the StringFormat doesn't display it.
My View element
My code
public static readonly BindableProperty PercentProperty = BindableProperty.Create(nameof(Percent), typeof(string), typeof(StatsControl), propertyChanged: (bindable, oldValue, newValue) => { var control = (StatsControl)bindable; control.PercentEntry.Text = newValue as string; }); public string Percent { get => GetValue(PercentProperty) as string; set => SetValue(PercentProperty, value); } The actual value is correctly presented and works OK. But no other text I place in the StringFormat either before or after the value is shown!
Источник: https://stackoverflow.com/questions/780 ... ional-text
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
StringFormat для привязываемого свойства, не отображающего дополнительный текст
Anonymous » » в форуме C# - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-