Click here to Skip to main content
15,894,955 members
Everything / Desktop Programming / XAML

XAML

XAML

Great Reads

by Daniel Vaughan
Calcium provides much of what one needs to rapidly build a multifaceted and sophisticated modular application. Includes a host of modules and services, and an infrastructure that is ready to use in your next application.
by Nick Polyak
This article explains the most important and basic concepts of Avalonia WPF-like multiplatform UI package.
by Alan Beasley
Explanation and examples of Additional Templates and Generated Content of a ListBox. Covering Layout, Transitions, and Animation.
by Dr. WPF
This article describes a new approach by which an element can remove its visual and logical relationships to its children while maintaining a conceptual parental relationship with those children.

Latest Articles

by Peter Sun (247)
Implement ChatGPT API in C# WPF with GPT3.5-turbo
by Chandru BK
This article will assume you have basic knowledge of C# and Xamarin Forms and shows how to implement the Xamarin Form Validations using simple Data Annotations applied on the models.
by Michael Chourdakis
A set of tools to create a new VCXPROJ file automatically
by vickyqu115
Control featuring design and animations specialized for mobile, but can be elegantly and structurally implemented using ListBox and Animation technologies available in WPF.

All Articles

Sort by Updated

XAML 

24 Apr 2024 by Graeme_Grant
I did a quick Google Search wpf datagrid multiselect dragging with scroll[^] and found this working solution: DataGrid auto scrolling when doing selection - solved[^]
24 Apr 2024 by Member 16239100
I want a WPF datagrid which can select the rows same as we can do in Win explorer. For the i have implemented some code and need some help in that. Here the autoscroll for up direction is working fine but for downside autoscroll its not working....
16 Feb 2024 by Peter Sun (247)
Implement ChatGPT API in C# WPF with GPT3.5-turbo
16 Feb 2024 by Andre Oosthuizen
Gerry gave the solution, to elaborate on taht - The TextBlock is a read-only control, and that's why you can't edit the content when you double-click on it - MS Learn | TextBlock Class[^] To use editing, you should use an editable control such...
16 Feb 2024 by 4711a
I have a DataGrid with a DataGridTemplateColumn. I'm not able to edit the Comment field. When I double click on a Comment field, the background changes a expected to LightSalmon and the content of the bound property Comment is shown but I cannot...
9 Feb 2024 by Chandru BK
This article will assume you have basic knowledge of C# and Xamarin Forms and shows how to implement the Xamarin Form Validations using simple Data Annotations applied on the models.
8 Feb 2024 by Mitchell J.
It's been agessss since I posted here but I came here on a whim this morning and saw this question & it caught my attention As others above have said, Avalonia, .NET MAUI, and WinUI 3 are all decent options. I also find (found?) writing XAML to...
8 Feb 2024 by Sander Rossel
Adding to the already plenty solutions, I've asked myself this question recently. For a customer, I need to replace old VB6 applications throughout a factory. Web isn't an option as I need to communicate with hardware on the machines (although...
8 Feb 2024 by logica
Try Flutter, You Won't Be Disappointed I faced the same dilemma as you - choosing the right framework for my next project. I evaluated numerous options, finally deciding on Flutter: it was a game-changer! The development speed and stunning...
7 Feb 2024 by Pete O'Hanlon
My answer, cross posted from the lounge[^]. If I were still using XAML, I would use Blend with it. It takes a little bit of getting used to, but it's far superior to working with the layout designers in VS. When I do have to write a pure desktop...
7 Feb 2024 by Richard MacCutchan
Roger Deutsch wrote a series of articles on the subject: Programming Windows 10: UWP Focus (1 of N)[^]. I worked through it all and built the examples successfully. But as all my programming is just for fun I don't think I will use it much in future.
7 Feb 2024 by Graeme_Grant
If you want to rant, shoot the breeze, etc, then use The Lounge[^] forum. This is for those who are stuck or stumped and need help with code.
7 Feb 2024 by honey the codewitch
I'm used to being able to whip up a simple to moderately complicated windows application using Windows Forms, and being able to get it to lay out everything without too much fuss. I can spend most of my time on the logic. This is good. Now, with...
3 Feb 2024 by mojtabahakimian
Project: I had Accounting project made in MS Access ADP 2003 project that connects to SQL Server database , Because it is not possible to create a beautiful and modern user interface with animation in Access, I decided to rewrite my program, I...
20 Jan 2024 by Michael Chourdakis
A set of tools to create a new VCXPROJ file automatically
15 Jan 2024 by Sh.H.
I found the answer. I should bind the Text to parent, then bind to the Class.
15 Jan 2024 by Sh.H.
Hi I have a DataGrid. I used TextBox in its cells. I made a ControlTemplate for it. So My problem is when I use controlTemplate, the Binding of TextBox won't work. But if I directly set everything in the DataTemplate, the Binding works perfect....
10 Jan 2024 by vickyqu115
Control featuring design and animations specialized for mobile, but can be elegantly and structurally implemented using ListBox and Animation technologies available in WPF.
6 Jan 2024 by Jo_vb.net
You can search @GitHub... This project GitHub - Alphabet85/WPFVideoPlayer: A video player created in WPF using MVVM techniques.[^] uses MVVM concept and it uses properties in VideoPlayerViewModel.cs and ICommands like private ICommand...
6 Jan 2024 by Mike-MadBadger
There is no built-in property for determining whether a MediaElement is playing or not. There are events triggered when a MediaElement is opened or ended. You can use the MediaEnded event to check when the media has finished playing. You can...
5 Jan 2024 by Graeme_Grant
You do not need to set the size of the Rectangle if you want to fill the Grid area. Now, if you remove the Width and Height of the Grid, the Grid will fill the parent...
5 Jan 2024 by Graeme_Grant
A quick Google search: WPF MediaElement is playing? - Google Search [^] found this: How to: Control a MediaElement (Play, Pause, Stop, Volume, and Speed) - WPF .NET Framework | Microsoft Learn[^] If you read the sample code you will see this:...
5 Jan 2024 by Graeme_Grant
If it is not working, then you need to point to the property using Path:
5 Jan 2024 by Graeme_Grant
You do not need a Rectangle to set the background color of a cell, you just need to set the Cell Style. Here is a working example:
5 Jan 2024 by Graeme_Grant
Yes, it is possible, but not recommended. Here are some examples: Bind to a method in WPF? - Stack Overflow[^]
4 Jan 2024 by Pete O'Hanlon
There is no in-built way that you can directly bind your ItemsSource to the result of a method. Anything you do is going to involve C# at some point. Theoretically, it might be possible to accomplish something of what you want by writing a custom...
4 Jan 2024 by Sh.H.
I need to make the size of Rectangle automatically takes the needed size of the Grid. Any idea please? What I have tried:
4 Jan 2024 by Sh.H.
Hi guys. I need to know how can I determine my video is now playing, or in Pause state, or in Stop state. In WPF. Any help please? What I have tried: I couldn't find any try! Just I used MediaElement from Toolbox.
2 Jan 2024 by Gerry Schmitz
Your Rectangle has nothing to use for a "size request" ... at a minimum, give the Rectangle a .MinHeight and a .MinWidth in this case (e.g. 24x24 or 32x32). If the Rectangle was "contained", and "stretched", you wouldn't need to specify...
2 Jan 2024 by Gerry Schmitz
Your approach to coloring the rectangle appears to be wrong in the first place (HTML vs XAML). Use a static resource as illustrated here since you need the same color in more than one place anyway. (Otherwise you'd use a Rectangle.Fill "object"...
1 Jan 2024 by Sh.H.
Hello I need to change the color of text in TextBlock equal to color of Rectangle in another part of the Grid. With respect, any kindly Help please? What I have tried:
1 Jan 2024 by Richard MacCutchan
Try it the way shown in this example: DataGridTemplateColumn Class (System.Windows.Controls) | Microsoft Learn[^].
31 Dec 2023 by Sh.H.
I just want to to set background of a cell to Red. I added a rectangle in the cell and change the background to pink. But I don't why my code does not work. Any help please? P.S: Accidentally I changed the Height of rectangle to 10, and I saw...
31 Dec 2023 by George Swan
My WPF is a bit rusty, but I would suggest that you set the window's DataContext to a view model instance and set the DataGrid Items source to a CustomerList property defined in the view model. So the Xaml would look like this:
31 Dec 2023 by Sh.H.
Hi everybody. I copy/paste this example code from DataGrid.ItemsSource Property (System.Windows.Controls) | Microsoft Learn[^]
21 Dec 2023 by Nick Polyak
Avalonia is a great new multiplatform UI package similar but in many respects better than WPF. This is an introductory tutorial article.
21 Dec 2023 by Nick Polyak
This article explains the most important and basic concepts of Avalonia WPF-like multiplatform UI package.
21 Dec 2023 by Nick Polyak
This article covers important concepts of Avalonia/WPF needed for programming and software design
21 Dec 2023 by Nick Polyak
This article describes basic functionality of Avalonia XAML providing easy to understand samples
13 Dec 2023 by Dave Kreskowiak
Your resource is a SolidColorBrush, not a Color, which is what From expects. I think your resource should be: #FF2E353F
13 Dec 2023 by Sh.H.
Hi folks. I tried to animate my ToggleButton during MouseEnter and MouseLeave. Below code works when I use directly the color code. But if I reference it to a resource, it doesn't work and give me exception. Exeption Thrown:...
10 Dec 2023 by Sh.H.
Solved! Sub New() InitializeComponent() TheMainWindow.Opacity = 0 End Sub Private Sub TheMainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles TheMainWindow.Loaded 'Fade in MainWindow page. ...
10 Dec 2023 by Dave Kreskowiak
It doesn't work because in the constructor of the Window class, you have only created an instance of the class, you have NOT created the window handle or even the window GDI objects yet. Try moving that fade code to the window Loaded event.
10 Dec 2023 by Sh.H.
Hi. In my designed program, pages change with fade effect which changes the OpacityProperty in DoubleAnimation. But I surprised why DoubleAnimation doesn't work on MainWindow.Loaded ? I mean at the starting of program, it doesn't work. Any Idea...
5 Dec 2023 by vickyqu115
How to create a day and night theme switch button using WPF
2 Dec 2023 by Sh.H.
This is final solution. Thanks Chris Copeland. ...
27 Nov 2023 by Chris Copeland
Could you not do something like: ...
27 Nov 2023 by Sh.H.
Hi people I have a text which is "Login" and a font icon. So I want to rotate the font icon 90 degree, but not the text. I tried below code, but no luck. Any kindly idea please? What I have tried:
26 Nov 2023 by Maciej Los
What about an idea on this topic: Developing a C# WPF Window with a Blurred Transparent Background[^]?
26 Nov 2023 by Gerry Schmitz
Quote: The AcrylicBrush is a Brush that implements an acrylic effect with customizable parameters. AcrylicBrush - Windows Community Toolkit | Microsoft Learn[^]
26 Nov 2023 by Sh.H.
Hi guys I tried a lot search on the net But I coudn't find how can I make the background of my application blur. I mean I like to see desktop blur which is behind of my application. Any kindly suggestions? What I have tried: Just searching the...
19 Oct 2023 by Member 10371658
I have a XAML form in MVVM, and there are some textbox and button controls, and I set the TabIndex property for that control, but when I click on tab button from keyboard, it's going to control according to tabindex set. Please help how to set...
18 Oct 2023 by Graeme_Grant
MVVM has nothing to do with the Tab order of controls. TabIndex sets the tab order when the Tab key is pressed. If you want a different Tabbing order, then change the TabIndex to the order that you want.
27 Sep 2023 by Sergey Alexandrovich Kryukov
How to generate C# code from XAML? But why? Anyway, this question is answered, but this is not the main part…
20 Sep 2023 by kiran biradar
i have a datagrid of 4 columns in that each column has 8 values.first column is non-editable and other three are editable and are textboxes. so my requirement is in first row i have 3 text boxes , and all the threee textboxes should accepts the...
12 Sep 2023 by Member 16091538
The UI doesn´t recognize the changes of the Imagestatuspath because of following reasons: 1 UI elements only can regcognize changes of properties in bindings when their class implement INotifyPropertyChanged 2 When you implement...
31 Aug 2023 by Sergey Alexandrovich Kryukov
Improvements used to fix an annoying WPF MenuItem defect related to icons
26 Jul 2023 by zlian_0
Same issue for me. MS removed template visual designer and resource manage view since VS2019. The best workaround I know so far is to edit raw XAML and use the XAML hot reload to view change at runtime. I think maybe they are thinking of phasing...
26 Jul 2023 by Ahmad_kelany
Hello everyone, I have a treeview:
10 Jul 2023 by suhail malik 2023
hi, I have image placed in resources/images folder. Trying to put image in some imagebuttons but images are not being shown on screen. any help is much appreciated. What I have tried:
10 Jul 2023 by Dave Kreskowiak
Or you could just get rid of the "images\" part of the filepaths in your Source attributes.
10 Jul 2023 by Andre Oosthuizen
If the images folder is outside the root folder, you need to tell your code as well - You first need to set your images Build Action to Embedded resource and set value for 'MyImageSource' in your view model constructor. In your project -...
2 Jul 2023 by CodeWraith
I am writing an emulator for a small 8 bit computer. It's a kind of prototyping and debugging tool for the real thing I have on a breadboard. It already can emulate highly timing sensitive code and give me information about what is going on...
2 Jul 2023 by CodeWraith
Well, I have found a solution. It's a little bit of work, but it will do the job. As I now see it, there are two concerns that should be separated. One thing is the configuration, which I want to be serializable, the other thing are the emulator...
21 Jun 2023 by OriginalGriff
To add to what Ralf and Patrice have said ... The only way that the code you show could cause that error message is if this code private void Window_Loaded(object sender, RoutedEventArgs e) { new HEAD_LST_FROOSH22().Show(); ...
21 Jun 2023 by Patrice T
Quote: Insufficient memory to continue the execution of the program for C# WPF You barely gave us enough information for wild guesses, but enough for sensible solutions. Yhe only sensible thing to do is to try on PC with 12GB or 16 GB to see if...
21 Jun 2023 by Ralf Meier
It's difficult to say something with this less Information ... but : 8 GB Ram with Win10 is not a lot of Memory because Windwos itself takes up to 5 GB for it's own. Now it depends on your Application what happens with the rest of the Memory and...
19 Jun 2023 by tb0rg
The wanted state is like this: There are notoverlaping containers (Borders) placed together on common canvas. When choosen Border is leftclicked, it is zoomed-in by animation and all other Borders are zoomed-out/moved at the same time. All...
3 Jun 2023 by FatalError0x4c
I can't simply set the x:Name attribute of the ComboBox because there are more than one. I also don't know how to get a specific ComboBox from code, to set/get the Text property. Here is a simplified version of my XAML file: ...
6 May 2023 by Michael Chourdakis
How to use the WinUI3 controls in a plain Win32 application without packaging
2 May 2023 by Graeme_Grant
When I hit an issue, sometimes I like to remove the noise and break out a small project that focuses on the main issue. I have done just that for you. Start a new WPF project with the name WpfDataGridComboBox and drop this code in and you can...
2 May 2023 by mojtabahakimian
Project subject: I had an MS Access 2003 adp VBA project that would connect to SQL Server Database, Now I'm converting that project to C# WPF, and I'm going to save data directly into SQL Server database from DataGrid in C# WPF Detail: I have...
29 Apr 2023 by TAUSEEF KALDANE
hello...i have create a custom textbox using "Windows Forms Control Library". And i want to use that textbox in wpf. How do I add reference to that dll and use that dll in xaml code?
29 Apr 2023 by Member 15991827
These days it's under Dependencies, right click to add reference, or go to Project > Add Project Reference.
11 Apr 2023 by IssamTP
A .NET XAML user control to get a simple PropertyGrid
6 Apr 2023 by Fazil13
I am using FileOpenPicker to select the file for that i am initializing with the mainwindow handle by using this API WinRT.Interop.InitializeWithWindow.Initialize but after closing the FileOpenPicker the mainwindow got freezes to retrieve the...
6 Apr 2023 by Gerry Schmitz
You're mixing Windows RT and WPF. You have a hack that is apparently "just working" (async interop). Stick to what is "typical". The OpenFileDialog - The complete WPF tutorial[^]
4 Apr 2023 by Graeme_Grant
Do not use fixed sizes like: Height="554" Let the TabControl fit the parent container content area. UPDATE I put your XAML (with the helix control removed) in my sample app and made a couple of tweaks and is now responsive, ie: no...
4 Apr 2023 by Ridhdhi Vaghani
What I want to do is that when I maximize the WPF window the TabControl should also be responsive with the WPF window. But in the following code the TabControl does not become responsive What I have tried: this my Xaml code:-
17 Mar 2023 by Luis M. Rojas
Was easy: var name=photo.OriginalFilename;
17 Mar 2023 by Luis M. Rojas
Hello everybody, I am new in xamarin form, I know how to take a picture, but: How do i get the name o named it in order to save it? What I have tried: I tried microsoft doc, web info
3 Mar 2023 by Christopher Fernandes
What is the issue here it is showing these error Error XDG0018 '{DependencyProperty.UnsetValue}' is not a valid value for the 'System.Windows.Controls.Control.Template' property on a Setter. Error XDG0006 Object reference not set to an instance...
23 Feb 2023 by Member 15746979
I tried a lot but I can't get it to be responsive please help me get it to be responsive What I have tried: This is my code for WPF(XAML):-
23 Feb 2023 by Graeme_Grant
Don't do this with your elements (controls): Width="98" Height="46" Let the container controls (eg: Grid) do the work for you.
18 Feb 2023 by Simos Sigma
I have two different projects... A WPF Control Library project where, among other files, I have some Resource Dictionary files... And a WPF Application project where into it's references I have add my WPF Control Library. My problem is when I...
9 Feb 2023 by Stanko Milošev
How to either migrate to the new XAML designer extensibility or write WPF custom control extensibility model based on .designtools.dll.
8 Feb 2023 by Max Speed 2022
hi, i have a Mainwindow.Xaml(wpf form) and 2x UserControl(EventPage.xaml and dashboard.xaml) inside this MainWindow.xaml i have a textbox and a button and i using this code to switch between my forms(EventPage.Xaml and Dashboard.Xaml) inside this...
8 Feb 2023 by Graeme_Grant
Why are you trying to pass a string in the constructor of the user control? This will only work if you are manually initializing the UserControl and adding to the main window - a one-shot deal. A UserControl is just a class with UI functionality...