HaaroWalo
HaaroWalo

Reputation: 91

Creating user control from XML for C# application

New programmer here so please be patient since my question may be too simple or even vague:

I am trying to build a simple Windows application with a UI that allows users to open other applications. This application needs to have a config file that can be updated so more buttons can be added in the future. Each button will also have a label, and a picture box close to it. I cannot use Winforms or WFP for this, as this needs to be done by writing actual code.

I understand that I should write an XML and create user controls. Can someone help me understand how I approach this in C# once I create the XML with the basic attributes for the individual controls, specially since they need to be placed the same way, every time a new button is added along with a label and picture box.

Secondly, can the XML have all properties for the controls, for example, mouseover (changes color), flat appearance etc. I currently only have the height, width, color, text included in the XML.

Upvotes: 1

Views: 669

Answers (1)

C. Augusto Proiete
C. Augusto Proiete

Reputation: 27868

Search for "data binding" - this is the fundamental concept in which you can link data coming from somewhere (e.g. your config file) to UI controls that can render that data in some way (e.g. picture box, etc).

If you're using WPF, for example, to create your app, read the WPF docs for Data Binding: https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms750612(v=vs.100)

Upvotes: 2

Related Questions