Tech Off Thread

1 post

WPF how to rise the custom event handler in user contorl in a list.

Back to Forum: Tech Off
  • User profile image
    whiteBox85

    I have a user control called (ProfileControl) which has a image with two textblock and a button. What I want is to show the data from the SQL Server in the main page of my application view each control next to each other horizontally. And respond when I press the button in the control.

    <ListBox Name="profileList" ItemsSource="{Binding}">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                </ListBox>

    From Code behind I did [code]this.profileList.ItemsSource = dbObj.GetDbData();[/code] and it is working properly.

    The only thing missing is I need to enable the event handle of the user control (which is a button) which is I need to write in the xmal (OnClickUserControl="UC_OutButton" // which is the event handler and the target method).

    But I don't know how to do.. Please advise me.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.