wpf

Best way to display and Edit a 2D array in WPF

Seems like this would be easy to do, but it appears its not so simple. I have a 2d array of floats or ints and I'd like to display it in a grid like control so it acts similar to Excel in regards to being able to move around with the arrow keys, tab keys, etc. The size of the array will vary. This comes close, but works well only for ...

MediaPlayer.Play(song) - can't be called twice with the same song?

this is what i have: MediaPlayer.Play(DataFile.AllMusicTitles[0].SongFile); System.Threading.Thread.Sleep(3000); MediaPlayer.Play(DataFile.AllMusicTitles[1].SongFile); System.Threading.Thread.Sleep(3000); MediaPlayer.Play(DataFile.AllMusicTitles[0].SongFile); play s0, sleep, play s1, sleep, then play s0, then 2nd time i pla...

Attach/bind the same set of commands to multiple controls

I have a Control inside a Canvas and I want to be able to move it using the arrow keys. For the sake of trying things out, I created the following class, which does what I want. <Window x:Class="DiagramDesigner.CanvasControlArrowKeyTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sc...

WPF animation sometimes doesn't run

I have some pretty simple code that attempts to slide a custom progress bar over. Here is the XAML: <!-- Progress display --> <uControl:ProgressDisplayPie x:Name="soakProgressDisp" Canvas.Left="357" Canvas.Top="29" ProgressValue="0" Height="198" /> In response to a button click, the progress bar slides over: private void sau...

Beyond Data Validation Styling: Styling based on other properties

I hope that this question has not been asked elsewhere, but I'm having difficulty finding the right search terms to bring up any already-existing answers to this problem. I'm implementing a program in C# WPF (MVVM) with many interview-style screens where the user inputs scientific data in an orderly manner. We would like to have the T...

Loading Custom Styles in a WPF Custom Controls Library

I have a Custom Controls Library (ex. MyCustomControls.dll) that is a plugin to a 3rd party application. It outputs as a class library and is invoked by the 3rd party application at runtime. My issue is the custom styles I have defined for various user controls like listviewitem, textblock now cannot be loaded at the application level. ...

Move a control inside a Canvas using directional keys

I have a number of controls inside a Canvas element and I want to be able to move them inside the Canvas using the arrow/directional keys (up, down, left, right). What's the easiest way to do this in WPF/code-behind? Is there an idiomatic WPF way of doing this? I guess I should clarify: I want to be able to move each control independent...

For a user control, how to set the binding of a item template item to a user property?

I have a simple user control, which is essentially just an AutoCompleteBox with some custom logic. For a specific instance (a collection of Persons), I want it to look like this: <sdk:AutoCompleteBox Name="myACB" ItemsSource="{Binding People}" FilterMode="StartsWith" MinimumPrefixLength="2" ValueMemberBinding={Binding LastName}> <sdk...

WPF ComboBox doesn't change the selected item

Hi people, I'm a newbie in WPF, so it probably is something very basic that I'm forgetting to do but I can't see what it is. I have a window with a combobox that display some data, I want the user to select a category in this combobox. It's working partially. The window show the combobox, starting with no selection, then the user choos...

handle an event and attach a command in the same time

Hello everybody, I have got a question about event and bound command. What happens if I bound a command to my button and also handle the click event in my code behind ? I mean, I have already tried and everything is ok but I was wondering whether this affects the efficiency or something else ? Is it a good practice ? In my case the c...

multilevel tabcontrol - which collection we use to bindin mvvm

Hi, I have a wpf application which uses mvvm pattern. I need to have a collection in my view-model...which i can bind to multi level tab control. What type of collection I can use in this case ??? Is there any hierarchical collection in C# 3.5 ??? ...

WPF Tableview swallows focus

Hi All, I have a DXGrid that contains a TableView. My Issue is that once I tab into the table view (SNOOP is showing it it focused), I never can exit out of the table view control. There are other controls after the tableview. All tabindexs are correctly set. Thanks ...

WPF FocusManager interferring with focus

Hi All, I have a grid, and in the grid I am setting my first element to be focused: <Grid FocusManager.FocusedElement="{Binding ElementName=companyNameField}"> When the window opens, the correct control is focused. But if I tab through the whole form, when the above focused field, should have the focus, there is no cursor evident an...

How to change the color of the a WPF `<Separator />`?

I use <Separator /> in my form but don't know how to change its color. None of Border /Foreground/Background does exist. Plese help. ...

Bind IsClosed property of context menu

I have project which implements MVVM pattern. I have WPF window which has reusable usercontrol in his xaml. UserControl consist of WPFDataGrid. Also DataGrid has ContextMenu. I want do some staff when context menu is closed. But ContextMenu class have not dependency property which give me ability to know is it close or not. I cannot farw...

WPF c# dynamically switch Itemtemplate when object class gets changed

Hello I've got the following scenario: WPF Treeview displaying custom objects, each of them containing a list of children. So the problem is: Each of the custom objects is controlled by a combobox that can change the current object from Class A to Class B/C/D and vice versa. Classes A-D are all subclasses of a superclass. So far so good....

mulit select listbox in wpf

how i can select five items in the single click on the list box?? if i click any item, i just want to +2 and -2 from the selected index. so my single click need to select five items in the listview. Am using C#(WPF). ...

WPF Listbox with usercontrol as ItemTemplate DataTemplate Binding Issue

I have created a simple MVVM wpf project. The basic Idea is to display data about the annual Income of a customer and the loans he has with various Banks. The Model consists of 2 Classes , Financial and FinancialLoans. The ViewModel consists of 2 Classes FinancialVM and FinancialLoanVM Below are the VM Classes: namespace WpfTester.Vie...

VistaBridge and Desktop window manager in WPF 4

I have started using WPF a short while back, and I'm in the progress of reading the book Pro WPF in C# 2008. Here they are using P/Invoke to "DmwApi.dll" to create Aero glass effect on windows, and they use the VistaBridge created by MS to create the new Task Dialog boxes. So basically what I'm curious about is if WPF 4 (that is not c...

How to display a different value for dropdown list values/selected item in a WPF ComboBox?

I have a WPF combobox bound to a list of items with long descriptions. The type bound to the ComboBox has both short and long description as properties. Currently, I am binding to the full description. comboBox.DisplayMemberPath = "FullDescription"; How to ensure that when the item is selected and displayed as a single item in the co...