官术网_书友最值得收藏!

How it works...

Let's have a look at the bits and pieces and how they are bound together. From steps 1 to 7, we have opened an existing solution and added a WPF project to that solution. In steps 8 to 10, we added a control to the WPF main form, from the toolbox. Since this is a WPF application, we went through an additional element; setting up the UI. In step 11, we have set up the UI elements using the properties window. 

In steps 12 to 15, we added a reference to the WPF project. Referencing the library we have created is the most important part. Without referencing, the WPF project is totally unaware of the library.  After referencing the library only, it will available to the WPF project. Step 17 tells the compiler to use the namespace of the library. Now we don't have to call the full namespace of the class inside the library. In step 18, we created a simple variable and stored a name. The next line creates an instance of the HelloWorld class inside the library. Finally, we used the Text property of the WPF TextBlock control to store the value from the SayHello(string name) method.  

In the final steps – 19 to 20, we have executed the code and tested it. 

主站蜘蛛池模板: 万载县| 珠海市| 德庆县| 土默特左旗| 汾阳市| 绥芬河市| 武穴市| 双峰县| 五华县| 宜春市| 正蓝旗| 讷河市| 文水县| 佛学| 富民县| 始兴县| 饶阳县| 叙永县| 县级市| 蚌埠市| 新源县| 武城县| 宜黄县| 新乐市| 中方县| 晴隆县| 罗源县| 东光县| 错那县| 乐陵市| 资阳市| 房产| 阜阳市| 剑川县| 光山县| 资源县| 安阳市| 阜新市| 呼和浩特市| 紫云| 尼玛县|