Click here to Skip to main content
15,890,527 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 

9 Jan 2010 by #realJSOP
You have to have Microsoft Expression to work on the project (or find the redistributables somewhere (probably the MSDN site).
18 Feb 2010 by #realJSOP
In the buttons template, you need to set a trigger for the mouseover event. You should be able to easily find an example using google.
12 Apr 2010 by #realJSOP
Have you run this under the debugger to see exactly what part of it is slow? Which line is taking the most time?
17 Apr 2010 by #realJSOP
I would create the Canvas object in question as a static (and globally accessible) object, and just use the static instance wherever it's needed.
18 Apr 2010 by #realJSOP
You need to handle the click event for the "node" (the visual representation of it on the screen).This means you need to add the handler when you create the node.
9 Jun 2010 by #realJSOP
Do you mean change color while the left mouse button is down, or change color permenantly after it's clicked?For the first choice, you need to add a trigger (in your XAML) that changes the color when the button is pressed. In the second, you could bind the button's Background property to a...
2 Jul 2010 by #realJSOP
The following will undoubtedly need some tweaking, but it should be close:int m_itemCounter = 0;bool TopOfList { get { return m_itemCounter == 0); } }bool EndOfList { get { return m_itemCounter >= listBox.Items.Count; } }private List GetNItems(int count){ List...
2 Jul 2010 by #realJSOP
You can't do it in a single TextBlock control.
30 Jul 2010 by #realJSOP
No, but you can write conditional code in the code behind that sets styles or in converters that set properties.We don't have conditional stuff in our code, but pretty much the entire layout/content is determined after reading database settings, and that's how we do it.
2 Aug 2010 by #realJSOP
Your Margin, HorizontalAlignment, and VerticalAlignment properties are all whacked out. Part of the problem with VS2008 is that when uyou move stuff around in the designer, it CHANGES those properties for based on what it THINKS you want to do. I don't know if VS2010 still does this, but I...
3 Sep 2010 by #realJSOP
Put the image in a Viewbox control, and set the Stretch property to "Fill"
18 Sep 2010 by #realJSOP
Determine the x:Name of the component, and set its Visibility property to Collapsed.
21 Sep 2010 by #realJSOP
0) You could create a new property in your data item that combines the item text with the enum name, and bind that new property to the listbox item.1) You could create a custom ListBoxItem template that contains an element for the listbox item text AND the enum name, and bind the two fields...
7 Dec 2010 by #realJSOP
No. XAML is a layout manager - nothing more.
12 Jan 2011 by #realJSOP
With either a DataTemplate, or an ItemTemplate.
18 Apr 2011 by #realJSOP
Microsoft makes the default styles available in a download, and are based on the selected windows theme.http://code.msdn.microsoft.com/wpfsamples#themes[^]Or you can find a 3rd party tool like Style Snooper[^].Google reveals all.
11 May 2011 by #realJSOP
What you're describing is a UserControl.
21 Jun 2011 by #realJSOP
You could do it this way: and then just use the style.
20 Jul 2011 by #realJSOP
well first, I would do this:if (_area != null)before trying to use it for anything.Second, set the debugger setting that allows you to trace into the framework code so you can see what the LongListSelector.Balance() method is trying to do. That might steer you towards solving the...
17 Aug 2011 by #realJSOP
Bind it's location to be relative to the position of the button it's related to.
31 Aug 2011 by #realJSOP
Why can't you work it out yourself? You have everything required to figure it out right in front of you. Intellisense will help you, too.EDIT ======================Google helps too:MSDN - Sample that shows how to create a transform programatically[^]It should be equally easy to...
23 Sep 2011 by #realJSOP
0) Look at the first line of your xaml. Remove the xmlns:x="#unknown">1) what is the removed property in the grid? I'm not familiar with that.
22 Nov 2011 by #realJSOP
Something like this:MyControl control = new MyControl();this.rootGrid.Children.Add(control);
13 Jan 2016 by #realJSOP
I wanted to match my ListViewItem style my my treeview and listbox items, but I can't get the style to take. I've got the following XAML for the style. I set the colors to black in the triggers so that it would be real obvious if I got it to work. I also only included one of the triggers in the...
13 Jan 2016 by #realJSOP
I figured it out. It was a "Stupid Programmer Trick" (tm). I was only loading the resource dictionary in one window. When I changed it to merged dictionaries in the app.xaml, everything fell into place. :)
11 Apr 2020 by #realJSOP
Any technology suitably advanced will generally be viewed as "magic".
25 Oct 2016 by #realJSOP
Put one of these in your event handler:Canvas ctrl = sender as Canvas;- or -Canvas ctrl = (Canvas)sender;If canvas is null, call this method:/// /// Finds the parent./// /// /// The...
25 Oct 2016 by #realJSOP
The binding for the inner button's IsSelected property merely needs to refer to the value of it's parent control's IsSelected property, something like this:"IsSelected={Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}}"
1 Nov 2016 by #realJSOP
Define your Dictionary as a public property in your C# code, and do this in the XAML. ...
7 Nov 2016 by #realJSOP
Set TargetType="DataGrid" on both styles.
4 Jan 2017 by #realJSOP
If the control is a child of the current control/form, use this.rtbBill.
16 Feb 2018 by #realJSOP
Use a DataGrid or ListView, and bind the collection to the ItemsSource property. Keep in mind that WPF performance degrades with large collections. This can be addressed, but you'll have to google for the solution to that, because it's a big topic. You may be able to find an article on CP that...
20 Feb 2018 by #realJSOP
You could set the button's Tag property to the object it's associated with. button.Tag = collection[index]; When the button is clicked, inspect the Tag property to perform some operation on the object. EDIT================================= If it were me, I wouldn't use a series of TextBlock...
15 Oct 2018 by #realJSOP
It's because the IFreezable object's CanFreeze flag is false. Since you provided no real info, that's the best I can do for you.
1 Oct 2019 by #realJSOP
If you want the data to go both ways, you need to bing to an UbservableCollection of objects that are derived from INotifyPropertyChanged.
4 Nov 2021 by #realJSOP
When you reference a resource from outside the file where it is implemented, you have to use {DynamicResource} to reference it. You also have to create a ResourceDictionary in your xaml.
17 Nov 2021 by #realJSOP
You probably want to create a usercontrol that uses that stackpanel layout. Alternatively, you could put it into a resource library and deal with it that way. Either way, you'd have a re-usable stackpanel. Google is your friend for both strategies.
29 Jan 2022 by #realJSOP
"Glass" is a theme in the OS, and affects all applications. I've found that making an application control its own transparency without specific relevance to the application itself is annoying to many users. I personally find no use for glass...
1 Jan 2017 by #realJSOP
Why don't you try creating a UserControl that contains your xaml. That way, you get all the benefits of having the code behind and can instantiate the code in your calling method:this.gridMain.Children.Add(new MyUserControl());That way, you maintain proper compartmentalization, and can...
11 Feb 2020 by .Net Perfect Dev
hi, i create a project WPF with 3 files xaml of user control in this architecture my question is how can i access from User control 1.1 to the the Grid control Parent? my objectif is maximize the popup child1.1 in same height and width of Grid...
28 Sep 2015 by 09hadi
Hello, I would like to get help regarding this. I have used a plethora of open source projects but due to my inexperienced-ness, I havent been able to get the result.I am working on this project, in which I have gotten my current location and the coordinates but I havent been able to get the...
30 Jun 2015 by 1sumitanand
This tip is for newbie developers.
1 Jul 2015 by 1sumitanand
Sorting of simple ListView Elements in Ascending/Descending Order
21 Jul 2011 by 2irfanshaikh
I think you should do it in XAML it self.When we change the CurrentPage simply Notify itand in xaml, use Multiple Trigger and Condition check the button content is same as CurrentPage then change the background.Put the Multiple Trigger Style
29 Jul 2008 by 2sky
Translate a WPF User Interface using the Google AJAX Language API in real-time
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...
29 Jan 2011 by 69Icaro
Analyzing the Snake game, we'll study an application for the new Windows Phone 7 platform, focusing on localization, Inversion of Control, navigation, transition effects, triggers, Isolated Storage, audio and we'll also use Blend to create a rounded glowing button, and other things...
13 Apr 2016 by @nkit Bajpai
This article discuss a simple application built using WPF MVVM design pattern and explain the basics of Command Binding and DataBinding.
14 Oct 2015 by _Amy
You are trying to use something that is null. This means you either set it to null, or you never initialized it.I would suggest you to step through the code and find the null object. You should check your MyScreen2 object.--Amy
5 Jan 2009 by _anil_
Store and organize your shortcuts for easy launching of files and applications
18 Mar 2014 by _Asif_
Check this linkhttp in c# GET a page[^]
27 Sep 2016 by _eol_
The goal of this article is to create flat image buttons with bindable properties.
8 Mar 2015 by _Maxxx_
After you click the +/- button, the button still has focus, so pressing enter 'clicks' the button - so changes the sign.
21 Oct 2013 by _Noctis_
Sorting out the confusion about these properties, and providing a demo app for them
20 Apr 2016 by _Noctis_
To save you from doing this every time you want a WPF/MVVM project, here it is, all rolled into one.
23 Aug 2009 by A Eastman
Project aimed at joint development between programmer and graphics artist
14 Jun 2021 by A-Games
Why am i getting this error? This is code from the microsoft website:
6 May 2010 by A5KEXTREME
HtmlPage.Windo...
16 Jul 2012 by aajeesh
Is there is any way in silverlight to access datacontext of a control's parent's parent. I have a user control bound to a viewmodel. User control contains a pivot control bound to one of viewmodel's property. So the pivot control item's datacontext is that property. Now i need to bind that...
15 Feb 2016 by Aaron Amberman
Advanced custom logical and visual tree walking methods
24 May 2013 by Aarti Meswania
Some Text.... Some Text.... Some...
5 Jan 2012 by Abbath1349
I posted two DataGrid on a form, but in the 2nd DataGrid binding does not work. The properties ItemsSource they show the same values. If one change in the second changes automatically. How do I make it work properly?
6 Jan 2012 by Abbath1349
relevant code: private void themeSelector2_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (myDataSet.Tables["Asks"]!=null) myDataSet.Tables["Asks"].Clear(); ...
20 Sep 2014 by Abdallah Gomah
Here you will find all about prayer time calculation:http://praytimes.org/[^]You will find the calculation method in addition to javascript code and also c# and other languages.
15 Apr 2019 by Abdelrahman El Kinani
Azure MySQL DB, how to design it, basic UWP todo demo
14 Sep 2020 by abdou_31
I have a datagridView and I'm trying to filter some row using Id row , it work fine but the problem is when for example I check the datagridCheckboxColumn and I click in the searchbox ( TextChanged event ) , I lost the items checked How can I...
27 Nov 2020 by abdou_31
I have a nested user control ( user control in other user control ) . Suppose that User Control 2 is in User Control 1 , I'm trying to set the Dependency property of TextDependesce in the User Control 1 , what I have exactly: The User Control 2...
5 Apr 2013 by Abdullatif M. Abu Al Rub
here is my solution using only XAML:1- in the headers of the .XAML pageadd this reference:xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"2- for any XAML object you want to set as drag-able use the following code(my example is on...
5 Apr 2013 by Abdullatif M. Abu Al Rub
to be more professional you should use the row and column definition property of Grid control.here is a complete example:http://msdn.microsoft.com/en-us/library/system.windows.controls.rowdefinition(v=vs.95).aspx[^] if you found that useful please don't forget to mark as solution.Regards
22 Dec 2016 by Abdulrahman Emad, Muhammad Magdi
A generic CRUD control implemented based on the MVVM pattern
22 Dec 2016 by Abdulrahman Emad, Muhammad Magdi
A generic CRUD control implemented based on the MVVM pattern.
25 Nov 2010 by Abhijit Jana
How to use Silverlight Chart Control with SharePoint 2010
25 Oct 2015 by Abhilash Raja
Building adaptive layout in a windows 10 app with relative panel and adaptive triggers
11 Oct 2012 by Abhimanyu Rawat
Here you can use javascript function HeaderClick(CheckBox) { //Get target base & child control. var TargetBaseControl = document.getElementById(grvLeaveDetails); var TargetChildControl = "chkSelect"; ...
20 May 2009 by Abhinav S
Finding a child control inside another control
12 Jan 2010 by Abhinav S
A simple Quickstart for using the Unity Container with Silverlight.
9 Jan 2010 by Abhinav S
You need to add a reference to the Microsoft.Expression.Interactions dll. To get the location of this dll - read here[^].Also, if you are opening someone else's project, make sure you have the right version of .Net installed.
7 May 2010 by Abhinav S
Indrajeet Sutar wrote:but it does not execute serverside code What if this serverside code is called in the constructor of bkdgghome.xaml?
28 May 2010 by Abhinav S
See if this post can help you out in anyway.
25 Jun 2010 by Abhinav S
Found a post here - just one solution is given there but it might help.You could actually use multiple text blocks - some bold and others normal to display data.
21 Jul 2010 by Abhinav S
I guess you are talking about two-way binding.See here.
26 Oct 2010 by Abhinav S
where FirstName will be a property within your model.
30 Oct 2010 by Abhinav S
On the whole, you should be doing that. All common resources should be moved to a common dictionary.Just as a sample, see here[^].
9 Dec 2010 by Abhinav S
First of all, I dont see a binding that says TwoWay.So whatever you type into the textbox your underlying datasource is not going to change.Second make sure you are not doing changes in code that could be formatting the text inside this textbox.
11 Dec 2010 by Abhinav S
You might want to start with some quickstarts[^].
25 Dec 2010 by Abhinav S
Maybe you could try setting a margin on each of the column headers.
12 Jan 2011 by Abhinav S
See here[^] for a workaround.
24 May 2011 by Abhinav S
Have a look at the RichTextBox[^] class in WPF.
28 May 2011 by Abhinav S
You can re-style See here[^] for an example.
4 Jun 2011 by Abhinav S
A logical unit is a 1/96 of an inch.Have a look at the last section in this article to get a solution to do this - http://www.wpftutorial.net/DrawOnPhysicalDevicePixels.html[^].
5 Aug 2011 by Abhinav S
A choice of database depends not so much on which programming language but rather on the requirements and what you / the client can afford. For a small web application, using Oracle would not make sense - the administration costs would be high. MySQL would be a good choice. Thus choose...
16 Aug 2011 by Abhinav S
Paste you code and then choose code block (if you are using an HTML5 compliant browser).Example as below - Xaml here
31 Aug 2011 by Abhinav S
AFAIK, there is no control that does this for you.So you will need to build something of your own.This article[^] might give you some ideas though.
15 Oct 2011 by Abhinav S
These articles might help you -Creating Inner Shadow Effects for WPF and Silverlight[^]http://www.silverlightbuzz.com/2009/10/09/using-blurs-and-shadows-in-blend/[^]http://asimsajjad.blogspot.com/2010/09/drop-shadow-effects-for-beginners.html[^][Update] Link for 3D shadows added -...
16 Oct 2011 by Abhinav S
Go through a book or some documentation on msdn / the internet for each of these parts individually.You should be able to find more information.For starters - Control Styles and Templates[^]WPF Data Binding - DataTriggers [^]
27 Oct 2011 by Abhinav S
These links should help you out - http://forums.silverlight.net/t/11702.aspx[^]http://blogs.silverlight.net/blogs/msnow/archive/2009/02/10/silverlight-tip-of-the-day-93-reading-xml-with-silverlight.aspx[^]
9 Jan 2012 by Abhinav S
If you can understand Routed Events, then will able to figure out the exact control the click is coming from - go through this[^].