Dmirty
Topic Author
Posts: 17
Joined: 19 Oct 2022, 19:50

User control binding and usage

28 Jun 2024, 20:46

Hi. I have an user control
<UserControl x:Class="HUD.UserStateIcon"
        ...
             xmlns:local="clr-namespace:HUD"
             d:DesignHeight="50" d:DesignWidth="50" RenderTransformOrigin="0.5,0.5">
	...
    <Grid x:Name="Root" RenderTransformOrigin="0.5,0.5">
        <Label x:Name="Text" Content="{Binding ItemText}" Grid.Row="1"/>
    </Grid>
</UserControl>
It has ItemText.
So, now I want to use the control somewhere:
<Window x:Class="HUD.MainWindow"
        ...
        <Grid>
            <local:UserStateIcon Grid.Column="1" ItemText="Hello world"/>
        </Grid>
How the properties should be defined in the control to work properly? I tried some, but always has "the property was not found in type".
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: User control binding and usage

02 Jul 2024, 08:56

Hi Dmirty,

Have you read our UserControls tutorial?
Do you need this for Native SDK, Unity or Unreal?

Who is online

Users browsing this forum: Bing [Bot] and 5 guests