开发者

learning test tool in WPF, WinForms

开发者 https://www.devze.com 2023-01-01 02:31 出处:网络
Do You know any good example or any good hint on how to make user controll that has defined text with blank areas which has to be filled out to complete excerc开发者_如何学JAVAise. Then submit answer

Do You know any good example or any good hint on how to make user controll that has defined text with blank areas which has to be filled out to complete excerc开发者_如何学JAVAise. Then submit answer and check (what was written in blanks and check if its good or not).

What Is the best way of doing that in order to be quite generic for example user (teacher) marks text which should be hidden.

It may be in WPF or WinForms (whatever is better for that).

thanks for any hint on how to begin and what to use.


I think I would have a (WPF) UserControl derived class that can take a custom formatted string (or xml) that contains the text and the placeholders to display:

myUserControl.DisplayContent="Rome was built in #numberofdays# day(s). The first mayor of Rome was #mayorofrome#."

The UserControl parses that string and builds the UI consisting of TextBlocks (the static text) and TextBoxes (the input controls).

Additionally the UserControl has a Property of Type Dictionary<string,string> that contain the strings entered by the user (keyed by placeholder string):

Console.WriteLine(myUserControl.Result["numberofdays"]);
Console.WriteLine(myUserControl.Result["mayorofrome"]);

This dictionary will be filled by the UserControl as the user enters the texts.

0

精彩评论

暂无评论...
验证码 换一张
取 消