wpf

WPF: How to make a Expander overflow and fill window.

I'm trying to create a expander that has a togglebutton/header as a slim bar to the left but when expanded fills over the rest of the window, even over material that's already there. I'm not really sure what the best way to do it is. I thought perhaps of a grid with 2 columns. First would have the expander, second the other material. Ne...

C# Entity Framework - Data bound combobox does not reflect changes made after .SaveChanges()

Hi everyone. Ok, this has been driving me nuts for the last two days! I'm new to C# aand have been teaching myself via writing a simple app. I have a simple form that comprises of a combobox and two text boxes. The combobox contains a list of the entities in the database table. The text boxes allow the user to add new entries. It is ...

How do I attach an id to a ListViewItem?

In my latest project, I have a ListView that is bound to an ObservableCollection. This ObservableCollection contains a number of objects of my class SongData: public class SongData { public int Id { get; set; } public string Title { get; set; } public string Artist { get; set; } } These objects are filled with data derived...

DataTemplate for ItemTemplate of a Grid displaying its content in columns

I have HeaderedItemsControl which ItemsSource is bound to a ObservableCollection<Person>. I would like to display it's content like: *Name* Müller Schmid Weber *FirstName* Peter Hans Willhelm *Age* 32 56 78 *Country* Switzerland Austria Liechtenstein My xaml-Code so far: <Heade...

Binding the ItemsSource for a WPF DataGridComboBox Column

Question: Most code samples on the DataGridComboBox seem to use a static resource as the ItemsSource. In my use case, I'd like to provide different ItemsSources with each bound object. Can this be done? Background: I'm trying to bind a collection of Question class objects to a WPF DataGrid, using a DataGridComboBoxColumn control. The...

How can I set my data binding in a WPF ItemsControl child to use a property on the parent data context?

I have a WPF ListView with a collection of RadioButtons. I want to set the GroupName of the child controls to be bound to a property on the parent data context. At the moment I am doing this by duplicating the property in each of the children's data context but that can't be right. My XAML: <ListView ItemsSource="{Binding OptionItem...

Place an Icon Object in WPF

Hi all, Ok firstly this is probably going to sound like a weird thing that I am trying to do, but please bare with me :) I have instantiated several System.Drawing.Icon Objects. Note that these are created at runtime and are not stored and loaded from the file system. I would like to place these images in my WPF application. However a...

WPF LINQ and the ObservableCollection

Hi! In my WPF application I'd like to use LINQ as much as possible (expecially to avoid the "for each"). But WPF works a lot with the ObservableCollection, and I can't use LINQ with these kind of collection. How can I do? Thanks, Pileggi ...

WPF, can´t load a COM dll in some client machines

Hi. I have an WPF Full Tust explorer application that uses a COM assembly. In some computers it works fine, in other ones it fails. There are too kind ok exceptions I got: ComException and FileNotFoundException. In the first case the dll arrives to clinet but the COm generator isn´t found (wich is the Com generator?? must i add it to th...

C# Action vs. Event vs. Queue performance

I have a Camera class that produces very large images at a high FPS that require processing by a ImageProcessor class. I also have a WPF Control, my View, that displays this information. I need each of these components needs to run on it's own thread so it doesn't lock up the processing. Method 1) Camera has an Action<Image> ImageCreate...

WPF asynchronous invoke question.

What's wrong in my code? It's not updating the TextBox and the ProgressBar while deleting files. Imports System.Windows.Threading Imports System.IO Class MainWindow Private Sub bt_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles bt.Click Dim sb As New System.Text.StringBuilder Dim files = IO...

Multi-touch ScrollViewer eating touch events

WPF 4.0: I have scroll viewer with many Sliders inside of it. I want the scroll viewer to pan with touch, and I want the internal slider to also respond to touch. Unfortunately, the scroll viewer is eating the "TouchMove" events and not passing them down to the slider control. Any idea how to fix this? Here is my XAML: <Window x:...

How can I make the Visual Studio debugger more useful when using the MVVM Foundation Messenger?

I've been generally very pleased with the MVVM Foundation Messenger, but I've noticed that when a messenger call causes an exception, the Visual Studio debugger doesn't ever seem to take me to the line of code that caused the exception (instead, it jumps to the method in the Messenger class that invoked the action). This forces me to do ...

wpf: how to bind text box to custom virtual keyboard?

Hi I am designing a custom virtual keyboard based on stack panel and including bunch of buttons in it for multi touch purposes. The keyboard will be defined as a resource in order to be used on different windows,canvases etc. My question is that, how to bind the focused text box to this custom virtual keyboard? Best regards. Celil ...

Can I make WPF set IsMouseOver for both the covering and covered element?

The simplified example this; picture a Venn diagram made from two elements, A and B, that overlap. If I mouse over (A AND (NOT B)) all of A lights up. If I mouse over (B AND (NOT A)) all of B lights up. If I mouse over (A AND B), BOTH should light up. Only the top most is marked as having the mouse over it. Is there a way to allow IsMo...

Multiple ViewModels associated with a single view

I have a View that displays a DataGrid which is bound to an ObservableCollection in the ViewModel. For the sake of discussion, let's say we have a Team View containing a Team DataGrid, in which each row represents a Player. My question is about what data type I should use to represent the players in my Team collection. Is it a good ...

UserControl PreviewMouseLeftButtonUp problem

Hi. I have a UserControl in WPF. I also have a Borderless window. To move it- I use DragMove. But- to get a click event in the user control- I use the PreviewMouseLeftButtonUp event and capture the mouse on UserControl_MouseEnter. The problem is- that if I click the control, then move the window- the event can be triggered also when clic...

WPF/Silverlight How To Calculate total cubic units/pixels in a control?

I have a scribbale inkpresenter in my silverlight app that I'm using multiple times in different shapes, I want to calculate how much percent of the inkpresenter has been scribbled, My problem is that since the shape of the ink presenter can be circular or poly I don't know how i can get the units/pixels there is available on the scrib...

How do I stretch the contents of a HeaderedContentControl?

I have a HeaderedContentControl that contains a TreeView. <HeaderedContentControl Header="Steps" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TreeView Name="WizardSteps" ItemsSource="{Binding WizardSteps}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <!-- Hierarchical data templates h...

Wpf Bind View to ViewModel add to wpf window

I have a view that contains a ItemsControl with some textblocks inside to display the name and other information. in my window I am adding the view to the window as follows and in the code behind of the window i am binding the datacontext of the view to the view model in the MainWindow Loaded event as follows ViewOwnerSideBar.Dat...