Page 1 of 1

User control binding and usage

Posted: 28 Jun 2024, 20:46
by Dmirty
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".

Re: User control binding and usage

Posted: 02 Jul 2024, 08:56
by sfernandez
Hi Dmirty,

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