StringFormat для привязываемого свойства, не отображающего дополнительный текстC#

Место общения программистов C#
Anonymous
StringFormat для привязываемого свойства, не отображающего дополнительный текст

Сообщение Anonymous »


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

Вернуться в «C#»