Page 1 of 1

Verwenden Sie das Verhalten stilvoll

Posted: 16 Mar 2025, 23:13
by Anonymous
Ich habe ein Verhalten, wie kann ich es im TextBlockstil verwenden, damit es auf alle Textblöcke angewendet wird. < /p>

Code: Select all





< /code>

Dies ist mein angeschlossenes Verhalten, das den leeren Wert im Grunde genommen auf n /a < /p>

ändert public class EmptyToNaBehaviour : Behavior
{
protected override void OnAttached()
{
var txtblock = this.AssociatedObject as TextBlock;

if (txtblock != null && string.IsNullOrEmpty(txtblock.Text))
{
txtblock.Text = "N/A";
}
}
}