# How to Create a bindable property, like the ones in the UMG (ex: TextBlock)

**URL:** <https://forums.unrealengine.com/t/how-to-create-a-bindable-property-like-the-ones-in-the-umg-ex-textblock/2247271>\
**Category:** C++\
**Tags:** binding, unreal-engine, CPP, Blueprint, question, UMG\
**Created:** [December 28, 2024, 1:36pm UTC](https://forums.unrealengine.com/t/how-to-create-a-bindable-property-like-the-ones-in-the-umg-ex-textblock/2247271 "2024-12-28T13:36:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![md.alzari](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/md.alzari/32/1205422_2.png) [@md.alzari](https://forums.unrealengine.com/u/md.alzari)\
**Post date:** [December 28, 2024, 1:36pm UTC](https://forums.unrealengine.com/t/how-to-create-a-bindable-property-like-the-ones-in-the-umg-ex-textblock/2247271/1 "2024-12-28T13:36:29Z")

</div>

How can I create a **bindable property** as in the TextBlock in UMG or any other class?  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/7/127cb199881ca52e7824fa4abcecc8477a385dd1.png)  
I did try to see what’s inside the TextBlock class, and I ended up having this:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/f/40f4748ffff6e00593c03707993022c50469b020.png)  
using this code only:

```auto
public:
    /** The text to display */
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Data", meta = (MultiLine = "true", ExposeOnSpawn = "True"))
    FText Text = FText::FromString("TextBlock");

    /** A bindable delegate to allow logic to drive the text of the widget */
    UPROPERTY()
    FGetText TextDelegate;

protected:
    // Macro implementation for Text property
    PROPERTY_BINDING_IMPLEMENTATION(FText, Text);

```

but the “GetText” function doesn’t fire, so the value doesn’t change.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/1/871941809ac274f8765050c157fdbc1bde56101a.png)

but it works when I use it in the Engine’s “Textblock”

tried to implement more code from the Textblock class, and still no change, here is the full code now:  
.h file:

```auto
// Copyright © 2024 Nova Electron. All rights reserved.
#pragma once

#include "CoreMinimal.h"
#include "CommonUserWidget.h"
#include "W_Text.generated.h"

class UW_CommonTextBlock;
class UW_Background;

UCLASS(Abstract)
class UW_Text : public UCommonUserWidget
{
    GENERATED_BODY()

protected:
    /* Widget Content */
    UPROPERTY(BlueprintReadWrite, meta = (BindWidget), Category = "WBP-Refs")
    TObjectPtr<UW_CommonTextBlock> CommonTextBlock;

    UPROPERTY(BlueprintReadWrite, meta = (BindWidget), Category = "WBP-Refs")
    TObjectPtr<UW_Background> Background;

public:
    /** The text to display */
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Data", meta = (MultiLine = "true", ExposeOnSpawn = "True"))
    FText Text = FText::FromString("TextBlock");

    // This function will update the property from outside the widget
    void SetBindableText(const FText& NewText)
    {
        Text = NewText;

    }

    /** A bindable delegate to allow logic to drive the text of the widget */
    UPROPERTY()
    FGetText TextDelegate;

    virtual TAttribute<FText> GetDisplayText();

    virtual void SynchronizeProperties() override;

    virtual void OnBindingChanged(const FName& Property) override;

protected:

    TSharedPtr<STextBlock> MyTextBlock;

    // Macro implementation for Text property
    PROPERTY_BINDING_IMPLEMENTATION(FText, Text);

};

```

.cpp file:

```auto
// Copyright © 2024 Nova Electron. All rights reserved.
#include "W_Text.h"

void UW_Text::OnBindingChanged(const FName& Property)
{
	Super::OnBindingChanged(Property);

	if (MyTextBlock.IsValid())
	{
		static const FName TextProperty(TEXT("TextDelegate"));

		if (Property == TextProperty)
		{
			TAttribute<FText> TextBinding = GetDisplayText();
			MyTextBlock->SetText(TextBinding);
		}

	}
}

void UW_Text::SynchronizeProperties()
{
	Super::SynchronizeProperties();

	TAttribute<FText> TextBinding = GetDisplayText();

	if (MyTextBlock.IsValid())
	{
		MyTextBlock->SetText(TextBinding);

	}
}

TAttribute<FText> UW_Text::GetDisplayText()
{
	return PROPERTY_BINDING(FText, Text);
}

```

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [January 2, 2025, 11:39am UTC](https://forums.unrealengine.com/t/how-to-create-a-bindable-property-like-the-ones-in-the-umg-ex-textblock/2247271/2 "2025-01-02T11:39:45Z")

</div>

Just a theory, but you can test it.  
The UTextBlock’s Text property has a BlueprintSetter in it

```auto
UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintGetter="GetText", BlueprintSetter="SetText", Category="Content", meta = (MultiLine = "true"))
FText Text;

```

and a respective `SetText(FText InText)` function.

Maybe you need to do the same?

---

<div class="post-metadata">

**Author:** ![lehuan5062](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lehuan5062](https://forums.unrealengine.com/u/lehuan5062)\
**Post date:** [November 20, 2025, 2:24pm UTC](https://forums.unrealengine.com/t/how-to-create-a-bindable-property-like-the-ones-in-the-umg-ex-textblock/2247271/3 "2025-11-20T14:24:58Z")

</div>

See UWidget and maybe UImage for references. A boolean example:

Header:

```cpp
	UPROPERTY(Category = "widget|button", EditAnywhere)
	bool bSelected{ false };

	UPROPERTY()
	FGetBool bSelectedDelegate;

	PROPERTY_BINDING_IMPLEMENTATION(bool, bSelected);

```
