Tag: WPF
Creating Button in XAML in WPF and Windows Store App
Below is a sample Xaml code that is used to create a button in WPF and Windows Store App. <Button xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” Content=”Abundantcode Button”/> The Button can also be created in the code behind of your Xaml page in C# . You would generally see the difference in the namespace based on the UI framework. For example , if you want to create a button in…
How to allow the user to pick Color from System Color Picker in Winforms Application ?
There are times when you might need to provide the user with the ability to pick the colours within your Windows application . You can use the ColorDialog class which is a built-in color picker which lets the users to pick the color within the app. How to allow the user to pick Color from System Color Picker in Winforms Application ? Just initialize the…
What is difference between ‘Name’ and ‘x:Name’ in Xaml ?
When working with a control in Xaml (WPF/Silverlight/Windows Phone /Windows Store App) , you will notice that for a control , there are 2 options to specify the name for the control . One using “Name” property and other using “x:Name” property. What is difference between ‘Name’ and ‘x:Name’ in Xaml ? Both the properties refer to the same item . We generally use x:Name…
How to get the Computer Name in C# ?
When working on a Winforms or Console application using C# , sometimes you might need to get the computer name where the application is running. How to get the Computer Name in C# ? To retrieve the computer name , one can use the System.Environment.MachineName property as shown below.
How to Allow only numeric input in a Textbox in WPF ?
If you are looking at ways to accept only digits and decimal points (numeric input) for a textbox in WPF , you could do it by following the below steps. How to Allow only numeric input in a Textbox in WPF ? Add the Event PreviewTextInput for the Textbox in the XAML. In the Xaml.cs , add the following. The regular expression is used so…
How to stretch ListBox Items horizontally to full width of the ListBox in Xaml ?
If you want the list items to horizontally stretch to full width of the ListBox in Xaml , you can set the HorizontalContentAlignment property to the value as shown below. How to stretch ListBox Items horizontally to full width of the ListBox in Xaml ? Below is a sample code snippet demonstrating the usage of the ItemContainerStyle of the Listbox to set the Style.
How to Pass enum as command parameter in Xaml ?
Below is a sample code snippet demonstrating how to pass enum as command parameter in Xaml. How to Pass enum as command parameter in Xaml ?