Posts

Showing posts from August, 2017

Using Expander controls in C# / WPF

Image
A short post demonstrating how to use expander controls in WPF, to create a list of collapsible / expandable menu items in your C# WPF application Create a new Visual Studio application Create a View Model class for your main window MainWindowViewModel.cs [code language="csharp"] using System.Collections.Generic; namespace ExpanderExample { public class ApplicationListItem { public ApplicationListItem(string name, string openButtonText, string updateButtonText, bool updateButtonVisibility = false, bool progressVisibility = true) { Name = name; OpenButtonText = openButtonText; UpdateButtonText = updateButtonText; UpdateButtonVisibility = updateButtonVisibility; ProgressVisibility = progressVisibility; } public string Name { get; set; } public string OpenButtonText { get; set; } public string UpdateButtonText { get; set; } public bool UpdateButtonVisibility {...

Creating and consuming a web service in C# / .NET

Image
Creating a web service in Visual Studio Note that in this post I am using the .asmx Web Service as an example, not the newer WCF version. See this StackOverflow post: https://stackoverflow.com/questions/36942846/web-service-template-missing-from-visual-studio-2015-professional Create a new Visual Studio project Use .NET 3.5 Right click on the project and select Add > New Item > Web Service (ASMX) See that the following code gets automatically generated in WebService.asmx.cs WebService.asmx.cs [code language="csharp"] using System.Web.Services; namespace WebService { /// <summary> /// Summary description for WebService /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System....