I'm using c# to develop a small UWP app for Windows IoT that is installed on Raspberry pi 3. However, I want to this:
button.Visibility = Visibility.Visible;
button1.Visibility = Visibility.Collpsed;
That code I want to keep it inside a static method :). I haven't found any helpful answer yet. I hope you guys will give me an easy and quick solution.
As a second option to Kevin's already sufficient answer, similar can be done with extension methods if you are working with one button at a time. You will need a using statement for the namespace the extension method is in.
Extension methods are a way of adding an instance method to an existing class.
see MSDN - Extension Methods
eg:
usage: