wpf

how to save a WPF image to a file

in WPF, the System.Windows.Clipboard.getImage() function returns a BitmapSource object. As a newbie in WPF coming from a WinForms background, its not clear to me how to save this image to a file. What are the steps I must take? ...

Effective books for learning the intricacies of business application development?

I am a self taught "developer". I use the term loosely because I only know enough to make myself dangerous. I have no theory background, and I only pick up things to get this little tool to work or make that control do what I want. That said, I am looking for some reading material that explains some of the theory behind application dev...

WPF DataGrid Columns not auto sizing when not visible

I have a datagrid inside an expander that are initially closed. When the expander is opened, the columns are all at the minimum width. Is there a way to force a recalculation of the widths? Thanks! ...

ControlTemplate Exception: "XamlParseException: Cannot find a Resource with the Name/Key"

If I move the application resources to a UserControl resources everythgin runs groovy. I still don't understand why. I noticed that my application object MyApp did more than inherit from Application it loaded an XAML for the main template and connected all the plumbing. So I decided to create a user control to remove the template fr...

learning test tool in WPF, WinForms

Hello, Do You know any good example or any good hint on how to make user controll that has defined text with blank areas which has to be filled out to complete excercise. Then submit answer and check (what was written in blanks and check if its good or not). What Is the best way of doing that in order to be quite generic for example us...

Is there such a thing as a dektop application event aggregator, similar to that used in Prism?

The event aggregator in Prism is great, and allows loosely coupled communication between modules within a composite application. Does such a thing exist that allows the same thing to happen between standalone applications running on a user's desktop? I could imagine developing a solution that uses WCF with TCP binding and running inside...

Lazy Loading wpf Combobox items

I have an IEnumerable<> which lazy loads it's data. I want to just set a Combobox's ItemsSource to the IEnumerable, but when I do it goes and loads all the data anyway (which removes the point of lazy loading). I've tried it with Linq-To-Sql as well since it seems to be a similar theory and it also loads all the data. Is there an easy ...

Is it possible to have a Shared/Static Dependency Property?

[using VB.NET, but I can easily read C# code in responses] I have a class called QuestionClipboard with ALL shared methods/properties. I previously had a QuesitonClipboard.doesClipboardHaveContent function that returned true/false if there was a Object on my 'clipboard'. I'd prefer to implement a Dependency Property so I can allow t...

CommandManager "cannot resolve symbol"

After adding "RelayCommand" class (that uses CommandManager class) into my Silverlight App I've got an error: The name 'CommandManager' does not exist in the current context This class is a member of System.Windows.Input namespace that is in PresentationCore.dll assembly. The problem is that I can't add this dll into my app... I a...

Can a WPF ComboBox display alternative text when its selection is null?

G'day! I want my WPF ComboBox to display some alternative text when its data-bound selection is null. The view model has the expected properties: public ThingoSelectionViewModel : INotifyPropertyChanged { public ThingoSelectionViewModel(IProvideThingos) { this.Thingos = IProvideThingos.GetThingos(); } public Obser...

How do I alter the default style of a button without WPF reverting from Aero to Classic?

I've added PresentationFramework.Aero to my App.xaml merged dictionaries, as in... <Application x:Class="TestApp.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Application.Resources> <ResourceDictionary> <ResourceDicti...

ListBox item doesn't get refresh in WPF?

I have a listbox which has couple of items. When double clicked on each item, the user get option to edit item (text of item). Now once i update the item, my item in listbox doesn't get updated. The first window (one which has listbox) is in MainWindow.xaml file and second window is in EditTaskView.xaml(one which let's edit the items ...

Can we bind dynamic data (dataset or list) to a control in WPF

Hi, I have a user control...and the base page(s) which uses this user control has a dataset which will be used by the user control. My dataset is dynamic...means..it can have different number of columns depending upon which page my usercontrol is implemented. Is there any control in wpf which i can use to bind this dataset (without kn...

Problem with focus in WPF

I have a WPF application which contains a WindowsFormHost and a DataGrid. Inside the WindowsFormHost there is a Windows Form User Control. The DataGrid selected item is binded to a property in the ViewModel. If the selected item changes while I'm holding down the left button of the mouse over the User Control, I lose the focus. Is ther...

Cancel uncheck in WPF

I use checkbox in WPF window. I use some logic in unchecked event of checkbox. And I want to cancel uncheck if need it in the body of this event. How can I do this? private void chApprove_Checked(object sender, RoutedEventArgs e) { btnAddDepartment.IsEnabled = true; brnRemoveDepartment.IsEnabled = true; } ...

Automated Tests of Custom Controls

What options do I have to automate tests for the various aspects of my custom WPF controls, such as: Layout behavior input and user interaction behavior general apperance ...

WPF: Can I use VisualStateManager to change alignment?

Hi, I've got this "object-stack" - Window --- Grid (VerticalAlignment = Stretch) ----- Border (VerticalAlignment = Stretch OR Top) The Border a primitive UserControl right now to keep things simple for me. I'd like to be able to use the VisualStateManager to toggle the VerticalAlignment-property of the Border, so that the "Normal-stat...

multi threading wpf

Hey, I'm using web refernce call in new working thread in my application as follow: Thread callRunner = new Thread(delegate() { _mediator.IncomingCallDetails(phoneNumber); }); callRunner.Start() ; the _mediator calls the web refernce and replay to the caller in event as follow: void IncomingCallComplited(IncomingCallEve...

AppDomain.UnhandeledException event not fired

In a WPF application, the app simply crashes, without the above event being fired. (I'm also registered to DispatcherUnhandeledException, which doesn't fire as well.) I conclude that it doesn't fire since the handler is defined to place a log entry. When looking at the log, there's no corresponding entry. It happens in a production en...

WPF XAML Bind Grid

I have a custom user control that is based on a Grid control. I have a ViewModel that exposes this as a property. I would like the XAML on the view to bind to this. I am sure this must be easy but I am quite new to WPF. How is this achieved? Many thanks in advance (Edited to add more info) Example of view without binding to ViewModel....