wpf

How can I display different ContextMenus in WPF ListView GridView?

I have a ListView GridView with ListViewItems that represent different categories of items. I'd like to display a different ContextMenu for each category of item. I was hoping to do this using DataTemplates but I'm struggling. My TreeView has a DataTemplate per category and I can see how I can set a different ContextMenu for each ther...

Prism - Commands Not Firing

Hi, I've got a view <UserControl x:Class="Modules.NavigationMenu.Views.NavigationMenuView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> <StackPanel> <Button Command="{Binding InspectionCommand}">Inspection</Button> <Button Com...

WPF Application moves offscreen during remote access session

Hi, i have a problem in which i am hoping to find the best and easiest to implement solution. I have written a WPF application which can be dragged around the desktop but i usually put it in the top right hand corner of the screen. My problem is that when i remote dial in from another location - where the resolution is always lower - ...

WPF Dispatcher Invoke Return Value

Hi all I have a call to a method that returns a UIElement that i call using the Dispatcher, below is the code. However the returnvalt of the Dispatcher is always NULL, any ideas? void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { var slides = (IList<UIElement>)e.Argument; var bmpSlides = new List<UIElement>(); ...

Implementing a scripting language in C#

Hi all We got a project where we're supposed to let 3rd party developers create their own GUI / CodeBehind drivers. Our GUI is running on WPF. Now, we got a number of possibilities for doing so, but one of the things we're considering is to create some sort of sub-Xaml XSD to let the create their GUI using markup (dunno if it'll be XAM...

WPF - Creating simple controls to be used on a Canvas

I'm developing a simple WPF UI for image post-processing. I'd like to create a draggable WPF control to be used on a Canvas which would look roughly like this: Both end points ellipses would be draggable and the line joining them would follow as the end points move. Now, I know how to implement this by simply adding these elements i...

WPF XAML Markup Compiler generates a bad URL in InitializeComponent()

Hey All, So I'm integrating WPF into a Windows Forms application I've built. One of the big hurdles I'm running into is that when the Markup compiler generates the .g.cs files in the background, the InitializeComponent method is being generated incorrectly. Here's what's generated: System.Uri resourceLocater = new System.Uri("/MapWorks...

Insert a null Value into a smalldatetime column in SQL using LINQtoSQL via VB?

I have a smalldatetime column in SQL that can have a null value, but when I try to insert a null value using SqlTypes.SqlDateTime.Null and LINQtoSQL it puts in 1/1/1900 instead of NULL. What is the best method to insert a null, or am I doing it at the moment. If I am using the correct method at the moment, what should be done to prevent...

C# WPF - Adding a child node to a selected node in treeview

Hi In WPF treeview control, I need to add a child node to a parent node i select using mousedoubleclick event. http://msdn.microsoft.com/en-us/library/system.windows.controls.treeview.selecteditem.aspx I followed the step in the MSDN, but i get invalidCastException when i do this. TreeViewItem newChild = (TreeViewItem)treeView1...

How do you bind a grid's children to a list?

In my ViewModel I have a list of items that I would like a grid in my view to bind to (the items will be the grids children). The list is a list of view models for the items. How do you bind a grid to the list (I can access .children in code but not xaml)? Also, how do you specify the data template (another xaml file) for the view mode...

Pass key press from win forms to wpf

I have a windows forms Form that has a menu bar that grabs Ctrl-C. Inside the form's copy handler is a switch statement calls the correct copy method depending on what kind of control is selected. I have now added a WPF UserControl as one of the child controls. In the UserControl, is a TextBox. I would like to have Ctrl-C activate th...

WPF: Cannot set focus

I want that from the PreviewTextInput handler a new control is created and focus is set to it. But even after calling Focus() on the new control, the cursor is still in the old textbox. The handler UserControl_PreviewTextInput is registered on the UserControl which contains this textbox if this matters. private void UserControl_Preview...

WPF-ListBox-Multibind Howto...

Here's the situation: ListBox has a ItemSource that gets its display and value data from Table A: Table A ID Activity 1 Skiing 2 Hiking 3 Fishing TableB has a list of people TableB ID Name 1 Tom 2 Dick 3 Harry TableC is an xref that joins up a list of people with their preferred activities... ...

Preventing a WPF Expander from expanding when header is clicked

How can I prevent a WPF Expander from expanding when its header is clicked? I would like my Expander to expand or collapse only when the expand button itself is clicked. I imagine the answer has something to do with canceling a bubbled event. If possible I would like to implement the solution in XAML while avoiding retemplating the enti...

Bind the Username in all Pages.

HI i'm developing a software(WPF) and i will insert a feature but i don't know how work out it. I have a Window Login (username,Password)to enter in the software after that the user insert the credentials appear a MainWindow and i have a textblock(txt_Username) to store the Username of the Window Login in this MainWindow.Now in the Mai...

Need advice on implementing UI in WPF

Hi, I need some advice on implementing UIs in WPF. So far, I've been using Code-Behinds, which is extremely easy to get-started, but hell when maintaining/changing/testing. I've looked at MVP (and its WPF variant - MVVM), but having some trouble getting started. Assuming I have a UI to build, here's what I think I should do: 1. Crea...

How to extract an individual item of an EntityCollection thru xaml binding?

Hi! I have a Contact entity that exposes a navigation proeprty for child Phone entities. Public Class Contact : Inherits EntityObject Public Property Phones() As EntityCollection(Of Phone) EndClass I want to Xamly retrieve the first phone of the bound contact. I tried the following but it doesn't work. Note: I also tried Phon...

How to set ContextMenu of a bound item?

I am trying to achieve the following: <Style TargetType="ListBoxItem"> <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu> <MenuItem Name="mnuEdit" Header="_Edit" Click="MenuItem_Click" /> </ContextMenu> </Setter.Value> </Setter> <Style> But it throws the followi...

WPF -- Displaying Image in RadGridView dynamically and through code

I have a radgridview which is bound to an object that I created, foo. Object foo has a property 'status' that is populated from an enum. I have many foo objects stored in a collection, which I use to bind to my radgridview. Upon binding I get records and the grid displays fine. I'd like to not display the 'status' enum value from my ...

WPF - Binding ValidationRules to Combobox.Text property

Hi, I'm using a WPF combobox whose IsEditable value is set to true. Basically, I have a list of times displayed int he comobo box. User can himself type in a time if he does not find a suitable time in the combobox. I have attached a ValidationRule to my ComboBox.SelectedItem so that whenever the user selects a time my ValidationCla...