Computing Archive

C# WPF – text box is not editable?

In my current work in the c#/WPF environment, I’ve had a need to create a new pop-out window with a load of text boxes and labels programmatically depending on a previous input. However, when I ran the code, the text boxes were not selectable, editable or changeable in any way. They just sat there, visible,

Calculating a log normal value from an average and standard deviation

It’s been a bit quiet round here recently due to project work at the office primarily with little Grasshopper work and little in the way of interesting snippets. However, one which I’ve decided to put here for future use is a function to calculate a log normal value from a given average and a given

Convert a number to an Excel column heading

As part of a project I’ve been working on in the office, I had a need to programmatically work with Microsoft Excel. This is a fairly easy process with the Interop.Excel DLL, however, sometimes there can be a need to work with language data types and convert them in a way that can be used

Use images as button icons in Dynamo components

Dynamo is becoming a bit of a ‘thing’ in the office recently, with a shift in some technology focus as Dynamo and the rest of BIM begin to really take hold in industry. As such, some people are trying to get ahead of the game and make sure their Grasshopper components can also work in

Random string generator for Grasshopper

As a bit of something quick and fun, I produced a random string generator component for Grasshopper. It’s a simple component with three inputs to control the number, length and chars included of strings and returns one output, a list of randomly generated strings. Quite what you’d wish to use this for I don’t know,

How should you be coding Grasshopper components?

Grasshopper has evolved somewhat since its beginnings and it’s becoming increasingly common to find Grasshopper developers out there looking to push the boundaries of visual programming/modelling. For the most part, scripting for Grasshopper was done within the built-in scripting components (for Python, C#, etc). It allows people with little programming knowledge to create their custom

C# GUI – blurring focus on a parent window when using pop-up windows

Continuing with the C# GUI theme of this week (using group boxes, finding UI controls using strings and making child windows stay on top), this post looks at how we can focus a users attention on a new window by blurring the parent. In some cases your software may have an additional window (as a

C# GUI – Make a child window stay on top at all times

Continuing on from my previous work this week (in using group boxes and finding UI controls by name), this post looks at how we can force a child window (such as a pop-up) to stay on top of the main window at all times. This can be particularly useful when you want the new window

C# GUI – Finding controls by name

With a C# GUI created in WPF, you can end up with large amounts of mark-up code in XAML defining your UI, and even more C# controlling the UI behaviours and propagating changes to the back-end. In some cases, you might have twenty controls with similar names. Hard-coding the name of the control each time

C# GUI with WPF – Using Group boxes

A short UI development post today following some work I’ve completed on building a new GUI for a project at work. Hopefully this post gives a brief introduction to those wanting to also use group boxes to group content, and how to resolve the issue where using group boxes may give you the error “The