wpf

Implementing a list box in WPF that looks like the "Songs" view in Windows Media Player 11?

I'd like to implement a view in my WPF application that looks like the Windows Media Player 11 Songs view. That is: Broken into categories by album. Each album has a the album art and album details. On the right is the list of tracks on that album, with further details. Any pointers? I'm fairly new to WPF. Note: Windows Media Player 1...

Enable scroll for WPF Treeview

Can anybody help me out with how to enable a treeview to scroll? There must be a simple way but I can't make it work in my code. After multiple failed tries, I currently have something like this: <ScrollViewer CanContentScroll="True"> <TreeView ...> </TreeView> </ScrollViewer> I do see an 'disable...

Multithreading TeeChart & Media Element

Hi, I am working in WPF, using a Media Element and a WPF TeeChart (by Steema). Both of these are visible and updating at the same time - whilst the video is playing, the graph will update at regular intervals to show data relevant to the current location in the video. The problem is that the TeeChart takes a long time to update, which ...

Implementing a volatile VSM state in WPF

I am using a VisualState to "turn a page" in my UI. After the page is turned I want to go back to the state that the window was in before going to the PageTurn state. So the transitions go something like this: StateDisplayContent -> StateTurnPage -> StateDisplayContent The only way I could find to do this was is code: private void...

wpf usercontrol, bind command parameter of button to the parent usercontrol

Hi, I've got a WPF UserControl which contains a remove button, I'd like to pass the entire UserControl as the CommandParameter. Currently the binding is set to CommandParameter="{Binding RelativeSource={RelativeSource Self}}" which gives me the button, but how can I get the entire control? Can anyone assist please? Cheers, Andy <Us...

How can I achieve a binding path which is bound by another binding?

Hi! I'm writing my own UserControl which displays data in a ListBox. I want to achieve something similar to a property like "DisplayMemberPath". In my example, it's "EditableMemberPath", which should determine which member will be displayed in the textbox. However, using a binding on a binding does not work. <ListBox ItemsSource="{Bind...

WPF ListView still reserving space when collapsed

I have a WPF ListView within a ScrollViewer. I need to collapse the ListView and I am trying withthis code (pretty striaghtoforward): this.myListView.Visibility = Visibility.Collapsed; Problem is the ListView seems to be reserving the space even when collapsed - it disappears but the ScrollViewer doesn't accordingly resize. Anything...

Setting a WPF control to expand to fill available space, and no more

How can I set up a WPF control to fill the available space in its parent's container, but not expand the parent? The following snippet describes the layout I am attempting. I would like the Grid to stretch to accommodate the Expander, and I would like the ListBox only to fill the Grid. I want the ListBox's scroll bar to appear when the ...

TemplateBinding not working with .NET framework objects...

Hi all, I am new to using the ControlTemplate. I am writing my first control but I am having (what seems to me) a very strange issue. Any dependency properties that I make that I TemplateBind to work, but any properties from the .NET framework objects i.e. the Content property of a ContentControl or the Items property of an ItemsContr...

How to compare values of two controls with a trigger?

I have to buttons, named btnOK and btnSave. I want that the IsEnabled of btnSave should be the same as the btnOK's value, i.e. if btnOK goes disabled, btnSave should do the same. I actually need something like (pseudu): <Button TabIndex="3" Name="btnOK"> <Button.Triggers> <Trigger Property="IsEnabled"> <Setter ...

wpf: Mousedoubleclick for textbox

Hi, How to handle mousedoubleclick in textbox text in xaml. This is how i am doing for keyboard enter in xaml <TextBox Text="{Binding Path=FullName, Mode=OneWay}" IsReadOnly="True" x:Name="txtFullName"/> < Button Command="{Binding OpenStaffDialogCommand}" ...

Databinding the DataGrid column header in code

How do I databind a WPF Toolkit DataGrid column header value in code (not XAML)? DataGridColumn fooColumn = new DataGridTextColumn { Header = "Foo", Binding = new Binding {Path = new PropertyPath("BindingPath"), Mode = BindingMode.OneWay} }; This databinds the content of the cells of the column. But ho...

What is the "proper" way in WPF MVVM to bind a frameworkElement event to a viewmodel handler?

So here is my dilemma, I want to handle view events on my view model, trouble is, in order to add an event handler, my view has to have a code behind file and therefore a class attribute has to be set. I'm 99% sure this is a bad idea, and to be perfectly honest, i'm not even sure how to do it (other than the obvious x:Class="" part) Wh...

Using a DataTemplate for a MenuItem causes extra space on the left side to appear?

Whenever I attach a DataTemplate to a MenuItem, each generated menu item gets an extra space on the left side. This extra space looks as wide as the space reserved for the check, which I use. Building a menu manually without a DataTemplate doesn't add this extra space. As an extra wrinkle, if I click on this extra space the menu item goe...

In WPF MVVM, how to spawn a background task that runs a callback on the UI Thread?

I'm familiar with the control's dispatcher object but that doesn't solve my issue in an MVVM scenario. I've got a UI command, that calls a method on my VM, that spawns a thread and then returns, when the thread is done (background worker might be good for this?) it will raise a callback, but the trick is, that callback modifies an obser...

How to filter a wpf treeview hierarchy using an ICollectionView?

I have a hypothetical tree view that contains this data: RootNode Leaf vein SecondRoot seeds flowers I am trying to filter the nodes in order to show only the nodes that contain a certain text. Say if I specify "L", the tree will be filtered and show only RootNode->Leaf and SecondRoot->flowers (because they both contain th...

WPF bug? Grid's column does not accommodate ListBox scrollbar

In the following example, the leftmost column's width does not increase to accommodate the ListBox's scrollbar that appears when the UserControl's height is decreased: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Example"> <...

Infragistics' XamDataGrid vs XCeed's WPF DataGrid Cons and Pros?

Infragistics' XamDataGrid & XCeed's WPF DataGrid are two free WPF DataGrids. What are some cons and pros of each and if you are familiar with both, why did you choose one over the other? ...

WPF: Video colors in MediaElement different from Windows Media Player

I have noticed (on my Vista 64bit machine) that a video being shown in a WPF MediaElement has different colors than when being played in Windows Media Player. Inside the MediaElement, the video has a slightly desaturated look with lower contrast. The videos I have tried so far are WMV videos that were produced by different people with d...

Problem with centering my WPF control

Hi i have a window where i add a new usercontrol to with an image, i simply want to center the image (thus the control) in the middle of the screen (both vertically and horzontally) can only get the vertical on e to work. Im gonna swap content in the dockpanel from my codebehind and want to show this startupd screen before i start doing ...