Click here to Skip to main content
15,884,960 members
Everything / Desktop Programming / WPF

WPF

WPF

Great Reads

by Dr. WPF
.NET 3.5 SP1 is here! It's time to break out your DirectX skills. This article provides the information necessary to get started using a new DirectX interop feature in WPF called D3DImage.
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 Fredrik Bornander
WPF Implementation of the spinning panel frequently used on the iPhone
by Sacha Barber
It would probably be like Cinch, an MVVM framework for WPF.

Latest Articles

by Macabies Gilles
An easy-to-use filterable, multilingual custom DataGrid control for managing and filtering data for your WPF applications
by gabriel4sonic
Shows how to use OpenGL in a .NET WPF application by directly incorporating an OpenGL window as a child of the main WPF window, making it behave more like a control
by Jo_vb.net
Part 2 of my article about 'Schafkopf' introduces Automated Bidding
by Peter Sun (247)
Implement ChatGPT API in C# WPF with GPT3.5-turbo

All Articles

Sort by Updated

WPF 

15 Mar 2010 by #realJSOP
We have a number of button images used in our app. As expected, management isn't sure that it's happy with the current images, so I am trying to come up with several different sets that can easily be swapped into the application. What's the best way to go about doing this? Is "use themes" the...
7 Aug 2009 by #realJSOP
0) Start Visual Studio1) Click File | New... | Project...2) On the left side of the subsequent dialog box, click "Windows"3) On the right side, click "WPF Application"4) At the bottom of that dialog, enter an entertaining, yet applicable name for...
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).
12 Jan 2010 by #realJSOP
If you remove the resource file, your *application* won't find it. I think your ownly recourse is to merge the resource file in each window that needs it (and take the merging out of your app.xaml file).
17 Jan 2010 by #realJSOP
Why are you comparing label values? That's really bad form. The code you posted doesn't make any sense at all.
21 Jan 2010 by #realJSOP
USE THE DEBUGGER.It would have allowed you to discover that there is only one item in the rdr object. Using a value greater than 0 will almost always result in an exception.
21 Jan 2010 by #realJSOP
Just create one storyboard for each animation.
12 Feb 2010 by #realJSOP
Your xaml isn't correct.You need to do something like this:
15 Feb 2010 by #realJSOP
Use the DispatcherTimer object instead of System.Timers.Timer. BTW, this is EASILY answered by using google.
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.
7 Mar 2010 by #realJSOP
WPF's ListView doesn't have "SubItems" like the Windows Forms ListView does.do this in yur C# code:listView.ItemsSource = myCollection;and something like this in your XAML ...
7 Mar 2010 by #realJSOP
If you can use google, you can find them. It's easy - really.
12 Mar 2010 by #realJSOP
nav234 wrote:why it is considered to be de rigeur for XAML application development.Because Microsoft thinks an arbitrary separation of programmers and "designers" would be a good way to make more money ($600 for the entire Expression library). Every question asked of Microsoft by a...
21 Mar 2010 by #realJSOP
You have to use Flex to develop a SWF that exposes functionality (like specifying the database connection, passing in data, and other control considerations). Once you do that, you can access the SWF programatically via C#.Specific info on interfacing a SWF with C# is available on the web. ...
19 Mar 2010 by #realJSOP
If it were me, I'd change the protection level (if necessary) on the internal UserControl, and then subscribe to the appropriate event from the main form.private void Load(){ this.userControl.innerUserControl.Button.Click += ....}I know, it's not very OOP-centric to expose...
23 Mar 2010 by #realJSOP
I found this exchange with google:WPF's DataGrid is a bit different than ASP.net's DataGrid. One way you can export to excel with WPF's DG is to use the DataGrid.CopyToClipboard command which makes a copy in a CSV, html, and text format. From there you can either just create a csv file or...
30 Mar 2010 by #realJSOP
Look at the DirectoryInfo.GetFiles() method. It does exactly what you need (returns an array of strings that represents the file names that exist in the folder in question.
5 Apr 2010 by #realJSOP
The proper way to do it is to have the parent form subscribe to the button-click event for the button on the user control. I think you may have to change the button to be public in order to do it, but I don't remember exactly if that's necessary.Once you've done that, simply rotate the grid...
22 May 2010 by #realJSOP
Programatically set grid row/column sizes (yes, even "Auto", "*", and "X*" - thanks Nish).
11 Apr 2010 by #realJSOP
Yes. Surface is written completely with WPF. There are plenty of details if you'd only use 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?
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.
19 Apr 2010 by #realJSOP
Well, your element name is ListViewTask, and your trigger is using listView.
19 Apr 2010 by #realJSOP
Two at the same time? You could write a custom PictureControl template that would allow two images. That would be the first thing I'd try.
21 Apr 2010 by #realJSOP
Looks to me like you forgot to put Mode=TwoWay into your XAML snippet.
28 Apr 2010 by #realJSOP
You can do it pretty much the same way. In fact, the code should pretty much be able to be dropped in exactly the way you already have it (with the appropriate variable name change for the treeview itself).
5 May 2010 by #realJSOP
http://weblogs...
9 May 2010 by #realJSOP
UIElement parent = this.Parent;
12 May 2010 by #realJSOP
You didn't mention which graph library you're using, but usually, you need to bind the data to a Series, and map the appropriate data properties.
15 May 2010 by #realJSOP
Your question is porrly word. Do you want to allow the user to edit the row in a listview, or do you want to change the value in the List?
15 May 2010 by #realJSOP
Find the item in the list with the desired ID and change the desired property for that item. There are a couple of ways you can find the item - iterating the list with a for loop, or using Linq. Personally, I think a for loop is more efficient, but a Linq statement requires less code.for...
22 May 2010 by #realJSOP
In WPF/Silverlight, you might want to bind to a dictionary. Here's a couple of websites I found.
25 May 2010 by #realJSOP
Google "microsoft office sdk", and see what you come up with. (I'll give you a hint - there are 1.78 MILLION hits).
25 May 2010 by #realJSOP
The only thing I can think of is it's because you haven't overridden the ENTIRE style/template. Microsoft has all of the standard templates available as a download, or if you have Expression Blend, you can just create a copy of the template.
4 Jun 2010 by #realJSOP
You might have some invalid xaml in your control that's not working. WPF is real touchy about that. Does the control show up in the designer?
4 Jun 2010 by #realJSOP
The problem I think is that your tiNew variable is being reallocated, so the program has the same tab twice. You sholud write a method that creates a new TabItem and sets all the appropriate properties, and returns the TabItem to be added to the TabControl.Items collection.
7 Jun 2010 by #realJSOP
I think you might be able to do this:In your Convert method:return new string(value);In your ConvertBack method:return ((string)value).ToArray();
7 Jun 2010 by #realJSOP
Set it's Visibility property to Hidden or Collapsed.
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...
9 Jun 2010 by #realJSOP
Try use the legend to do that. You might even find some code (using google) to do that.
1 Jul 2010 by #realJSOP
Try {Binding RelativeSource{RelativeSource=TemplatedParent}, Path=(property name goes here)instead of{Binding ElementName=thumbCanvas, Path=ActualWidth}
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
Are you using an ObservableCollection, and are your collection items derived from INotifyPropertyChanged?
2 Jul 2010 by #realJSOP
You can't do it in a single TextBlock control.
9 Jul 2010 by #realJSOP
Change the trigger to bind to the state of an internal bool property that indicates whether or not the user clicked okay or not...
9 Jul 2010 by #realJSOP
This is just a wild guess, but I suspect it involves a storyboard/animation which changes the perspective. I found this with google, and you could have, too.http://www.codegod.de/WebAppCodeGod/wpf-3d-animations-and-textures-AID439.aspx[^]
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.
31 Jul 2010 by #realJSOP
Are you playing the swf file into a web browser control? If so, you should be able to set the following on the web browser: It *should* cause the swf do grow with it.
2 Aug 2010 by #realJSOP
Do all of these things:0) Set the HorizontalAlignment and VerticalAlignment properties to Center.1) Remove the Margin property completely2) Set the Width and Height to something that does not exceed the resolution of the monitor.
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...
12 Aug 2010 by #realJSOP
button.IsEnabl...
12 Aug 2010 by #realJSOP
Change the Margin property.
19 Aug 2010 by #realJSOP
You need to use Winforms integration to make that work. Here's a link that might help.http://blogs.msdn.com/b/mhendersblog/archive/2005/09/23/473065.aspx[^]If that doesn't help enough, google this phrase:"activex control in wpf"
20 Aug 2010 by #realJSOP
Have you tried using a globally accessible object (derived from INotifyPropertyChanged), change it with one window, and read it with the other.
25 Aug 2010 by #realJSOP
You might be able to enclose them in a WinForms control, and then include the WinForms control in your WPF app, but that's highly theoretical. Maybe google can help answer that, or you can just be a programmer and try it out.BTW, why would you want to ruin your app by using Active-Xcrement?
25 Aug 2010 by #realJSOP
There's no support for MDI in WPF - at all.
7 Sep 2010 by #realJSOP
You have to make the messagebox modeless, but still stay on top.This might mean creating your own messagebox class.
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...
22 Sep 2010 by #realJSOP
I recommend that you learn how to use google. It takes much longer to get an answer to your question here than doing a search on google.
6 Oct 2010 by #realJSOP
The timer thread should perform the while loop and at the desired interval, send a message back to the form which can then use Dispatcher.Invoke to update the button.At least, that's the way I'd do it.
6 Oct 2010 by #realJSOP
Why don't you let the WinForm control be in charge of scrolling itself, and just put it in the WPF form?
13 Oct 2010 by #realJSOP
i rfs 2 rply 2 ne1 uzing txtspk
18 Oct 2010 by #realJSOP
You have to make sure the app is compiled with the new user control before trying to use it in the designer.
22 Oct 2010 by #realJSOP
When I come up against stuff like this, I resort to creating a simple test application to see what happens. That's what I suggest you do to find your answer.A worm with overlapping (but not completely overlapping) controls with the mouse enter event specified. Then run it under the debugger...
25 Oct 2010 by #realJSOP
NNow that you've learned the basic concepts of WPF, what does it have to do with a conent management system? You could possibly convert your knowledge of WPF to Silverlight, but a CMS is pretty heavy software for Silverlight. You'd have to be very careful with loading modules so you don't...
1 Nov 2010 by #realJSOP
Grid.SetColumn...
16 Nov 2010 by #realJSOP
Why are you making it hard on yourself? If you're creating it dynamically, why not just hold onto in in a global static variable? That way, you can access it from anywhere you might need to.Did you assign it a Name? If so code like that shown at this link should...
21 Nov 2010 by #realJSOP
You should rethink your UI design. A form full of buttons is one of the worst ideas I've seen. If your buttons can be categorized into groups, consider using a TreeView or even better, a menu. If they can't be categorized, consider a ComboBox or ListBox to contain the form names. If for...
29 Nov 2010 by #realJSOP
Try this:0) Get the parent container from the control's Parent property1) Get the collection of children from the parent's Children property2) Find the control int he children collection that's currently got the focus3) Set the focus on the next child in the children collection.
7 Dec 2010 by #realJSOP
No. XAML is a layout manager - nothing more.
7 Dec 2010 by #realJSOP
What you could do is change the icon when the object is dragged over an app that's running in admin mode (and your app isn't).
11 Dec 2010 by #realJSOP
Have the program that's writing to the file open it with write exclusive, and have the other program run a FileSystemWatcher on the file. When it detects that the file has been written to, it can then read from the file.Yes, threading will be required so that you don't lock up the UI on the...
17 Dec 2010 by #realJSOP
This is just a stab in the dark, but try changing the TargetType in the style to just be "TextBox" (instead of "x:Type TextBox").EDIT ====================Try moving the style into the grid: If that doesn't work, move it into the...
20 Dec 2010 by #realJSOP
You probably need to create a thread on the ButtonDown event, and abort that thread on the ButtonUp event.The thread will sit/spin until aborted, and every 1/2 second (or the interval you specify), the target value is increased. If it were me, I'd use a BackgroundWorker object as my...
20 Dec 2010 by #realJSOP
What makes you think we have any better insight than people that work at Microsoft? Depending on what day it is and who's blog you're reading, Microsoft is talking about abandoning WPF, Silverlight, and now, Winforms. I guess we'll all soon be out of a job.
23 Dec 2010 by #realJSOP
The only way to convert it to WPF is to do it by hand (manually). You could also use the WPF/Winform Interoperability to bring the whole form over as is, but that's kinda ugly, and is not, of course, pure WPF. If you do decide to go this route, I would put the Winform form into its own...
25 Dec 2010 by #realJSOP
To add to Eddy's answer, you would do something like this:if (sender is TextBlock){ // ... do something }else if (sender is Button){ // ... do something }
24 Dec 2010 by #realJSOP
Try this:Grid eobj1 = (Grid)(LogicalTreeHelper.FindLogicalNode(this.poolTable, "poolBall"));The FindName method is universally despised due to its apparent flakiness. I'm sure there are rules regarding its use, but sometimes it's better to just accept that aspect, and find another way to...
26 Dec 2010 by #realJSOP
WPF does not support the MDI paradigm. That's one of the reasons VS2010 (in its own UI) doesn't support it anymore either. People have complained, but I don't know if MS is going to take steps.
27 Dec 2010 by #realJSOP
Google this phrase - "c# wpf tab control", and revel in the glow of 248,000 returned results. There are several good links on the very first page.
29 Dec 2010 by #realJSOP
No. That subject is way to broad to be answered here. The best thing you can do is develop some initiative and google ".Net 4.0". There are MILLIONS of results awaiting your perusal.
7 Jan 2011 by #realJSOP
It's not the ProgressBar that's cpu-intensive - it's your code. If you want to prove that theory to yourself, simply comment out all of the calls to all of your ProgressBar controls.
12 Jan 2011 by #realJSOP
With either a DataTemplate, or an ItemTemplate.
12 Jan 2011 by #realJSOP
You could use google to find the answer. BTW, they're called "gridlines".http://www.designerwpf.com/2007/12/11/how-do-i-set-up-grid-lines-for-my-listview/[^]
14 Jan 2011 by #realJSOP
Googling "wpf printing" giveds back 348 THOUSAND results. This is one of them:http://www.eggheadcafe.com/tutorials/aspnet/9cbb4841-8677-49e9-a3a8-46031e699b2e/wpf-printing-and-print-pr.aspx[^]Feel free to google it yourself if that link doesn't help you.EDIT===============If you...
16 Jan 2011 by #realJSOP
If this is in connection with a web service, that error means that the WSDL doesn't have a Service section defined to specify where the web service is located.If you google the error, you'll probably be able to find an more precise description of your problem.
19 Jan 2011 by #realJSOP
Put the code in CheckConnection into a thread, and then display/update the progressbar via appropriate mechanisms (Invoke).
21 Jan 2011 by #realJSOP
You're also not setting the image source property to what you're hoping is the returned image.I don't know if you need it or not, but I use this method to convert a byte[] array to an BitmapImage...
21 Jan 2011 by #realJSOP
We're not going to do your work for you. If you have a question about something you've actually tried to do, we might be able to help, but coding from scratch? For You? For Free? Not gonna happen, Sparky.
7 Feb 2011 by #realJSOP
AppSettings if for settings not necessarily related to the WCF service. How the clients connect are determined by how you decide you want to do it. If it were me, I'd develop a centralized sever app that marshalls messages between connecting clients. That way, each client would simply need to...
8 Feb 2011 by #realJSOP
If that's what you heard, then that's what you should study up on. Chances are pretty good that they'll be asking fairly basic questions, but that really depends on the amount of experiecne they're looking for. Without a fairly basic understanding of the cited technologies, you're going to have...
8 Feb 2011 by #realJSOP
Based on the last question of yours that I answered, if your upcoming interview mentioned WCF and WPF, you should probably look for work elsewhere. By the looks of things, you don't even have the mental chops to use google on your own.
9 Feb 2011 by #realJSOP
Handle the control's Loaded event, and see if its Children colleciton is populated at that point. A WPF control doesn't have any children until it has been rendered.
18 Feb 2011 by #realJSOP
Really? Evaluate the requirements, decide on your supported platform, and choose the appropriate language/framework. Analisys part of learning how to be a programmer.
28 Feb 2011 by #realJSOP
string code = "";string myString = "{ name = tuutusdydfh, code = cs11 }";myString = myString.Replace("{", "").Replace("}", "").Replace(" ", "");string[] parts = myString.Split(',');foreach(string part in parts){ if (part.StartsWith("code=")) { code =...
16 Mar 2011 by #realJSOP
What do you WANT to happen? Once a thread is started, it shouldn't be blocking the UI. public void button_Click(...){ Thread thread = new Thread(new ThreadStart(ThreadProc)); thread.Start();}public void ThreadStart(){ // do something}Even if you use a...
16 Mar 2011 by #realJSOP
They ALL work over the internet. And yes, WCF should be fine. You don't have to worry about clients IP addresses because they don't change as long as their connection to the internet is alive. The only time their IP will change (about 99.99% of the time) is if they cycle the power on their...
16 Mar 2011 by #realJSOP
Have you run it under the debugger to see what's happening when you try to select a list item?
16 Mar 2011 by #realJSOP
Don't use an ArrayList - use a generic collection. Once you've converted your code, check out this tip/trick:A Generic Comparison Class for Collection Items[^]
24 Mar 2011 by #realJSOP
Why are you putting stackpanels on a canvas? Are you animating the canvas? If not, it just seems redundant.