wpf

WPF Image change source when button is disabled

Hi, I'm trying to show a different image when the button is disabled. Should be easy with triggers, right?! For some reason, I have not been able to get the image source to switch to the disabled image when the button is disabled. I've tried setting triggers on both the image and button. What is wrong with what I have below? How can I...

How do you Bind to a ComboBox in a DataTemplate?

I have a listbox that is bound to an observable collection of Audio (custom class). The Audio class has two properties, DisplayText (string) and a property called TarpIds (Observable Collection of Integer). I need to allow the user to change the TarpID in the combo box for each list item displayed and catch the selection change. I cre...

How does one bind to a List<DataRow> collection in WPF XAML?

Using a DataView one can specify the binding for controls in XAML for example as follows: <Image Source="{Binding Thumbnail}" /> I have a control that displays a number of images. I can get this to work with a DataView as the data source for the control, but I want to use a List collection of DataRow objects, which is not not working ...

how to make fishbowl(WPF Client for Facebook) multi-user compatible.

Hi everyone, I need to make the fishbowl application (which is a WPF application for Facebook) multi-user compatible. It seems, it's only supporting single user login via facebook. Any ideas how to make it multi-user compatible. applicate you help. -Aruna ...

Cross Thread Exception in PropertyChangedEvent in WPF

I have a ListView that is binded to my custom collection. At run time , I am updating the certain properties of my entity in my custom collection in my ViewModel. At the same time , I am also doing the custom sorting in the listview. The custom sorting is applicable when I click on the any column header of the listview. For example, ...

Proper implementation of NLog and Prism

What would be the best way to implement NLog in my Prism / CAL WPF application. This might be an amateur question, I am a bit new to the whole Prism framework :) I thought about putting the reference to the NLog dll in the Infrastructure module and make a wrapper singleton class e.g. MyLogger. My thinking was to be able to have the refe...

Easy way to use Images in WPF

Hi All I've only just started using WPF. (I'm a WinForms guy), and from what I can see, trying to simply drag an image onto the Window is a huge PAIN. There seems to be no way where you can just select an option to tell it what picture to put indide the image control. I've seen so many sites within the last 10 minutes with atleast 10lin...

How do i navigate from one Xaml file to another?

I am very new to XAML and WPF.I have a problem. I have two files. first.xaml and second.Xaml. There is a button in first.xaml, on click of which it should navigate to second.xaml.How do i achieve this. ...

EventAggregator, is it thread-safe?

Is this thread-safe? The EventAggregator in Prism is a very simple class with only one method. I was surprised when I noticed that there was no lock around the null check and creation of a new type to add to the private _events collection. If two threads called GetEvent simultaneously for the same type (before it exists in _events) it l...

how can i get notified on every control clicked in another application?

Hi all, Im writing an application that needs to get notified when a control in another application is clicked\invoked. How can i catch the click from my application? Here are some more related questions : Is UIAutomation can be a solution? is it working on unmanaged applications also? Is the Spy++ solution works also on managed applic...

Multiple key binding in WPF

How can i execute some command on, lets say, Ctrl+Shift+E? As i saw we can write the following: KeyBinding kb = new KeyBinding(TestCommand, Key.E, ModifierKeys.Control); this.InputBindings.Add(kb); But how can i add more ModifierKeys or Keys? ...

What is the best way to keep ViewModel Collection in sync with Model

In my application, I have a model object that contains a collection lets say List<Chair> that gets updated frequently. ViewModel has an ObservableCollection<ChairViewModel> that wraps List<Chair>. Since List<Chair> gets updated frequently, I need to keep ObservableCollection<ChairViewModel> in sync with it so that every change in List<...

Custom Brush - I want two gradients chaining them together.

I am making a bar chart and I want two separate gradients for each bar. First I want a gradient to go from top to bottom solid red to transparent red. I want to paint over the top of that a gradient that goes from right to left, black to opaque. So - In the bottom left we should have; Bottom left - Alpha 0 Bottom right - Alpha 0 Top l...

Resizing TextBox At Runtime in WPF

Hi All, Was just wondering how I would go about letting the user resize a TextBox control at runtime by dragging its corners in WPF. Less importantly, is the same technique used for the resizing of all controls? Thank you :) ...

What is the best way to detect if my page needs saving - ussing WPF MVVM

I have an application where you can open many different items (like in excel you can open many different tabs) If an item or "tab" is modified I want to detect the changes and allow the use to save or prompt if the user closes without saving. Maybe enable/disabling save button when a save is available/not available. I am using c# WPF wit...

how to get header controls in data bound TreeView

Hi, I have TreeView with hierarchical data binding. I want to get TreeViewItem.Header controls not my MVVM. I can get TreeViewItem using TreeView.ItemContainerGenerator.ContainerFromIndex() method... but how to get TreeViewItem.Header ? Regards, Marcin ...

A window that behaves both modally and non-modally

I want to create a WPF window that behaves as a modal dialogue box while at the same time facilitating selected operations on certain other windows of the same application. An example of this behaviour can be seen in Adobe Photoshop, which offers several dialogues that allow the user to use an eyedropper tool to make selections from an ...

WPF ListView column auto sizing

Let's say I have the following ListView: <ListView ScrollViewer.VerticalScrollBarVisibility="Auto"> <ListView.View> <GridView> <GridViewColumn Header="Something" DisplayMemberBinding="{Binding Path=ShortText}" /> <GridViewColumn Header="Description" DisplayMemberBinding="{Bi...

MVVM Focus To Textbox

How would I set focus to a textbox without specifying the name for that textbox? At the moment I am doing the following <Window FocusManager.FocusedElement="{Binding ElementName=Username}"> <Grid> <TextBox Text="{Binding Username}" Name="Username" /> </Grid> </Window> Is there any way of doing this without ...

Value of text box disapears - binding viewmodel to a tab (content control)

Based on the MVVM example by Josh Smith, I have implemented the multi tab option which binds to a different tab to a different view model using a simple datatemplate that binds a viewmodel to a view. <DataTemplate DataType="{x:Type fixtureVM:SearchViewModel}"> <SearchVw:SearchView/> </DataTemplate> The issue that I'm having, is...