wpf

ObservableCollection is not updating Multibinding in C# WPF

I have a TreeView that creates all its items from databound ObservableCollections. I have a hierarchy of GameNode objects, each object has two ObservableCollections. One collections has EntityAttrib objects and the other have GameNode objects. You could say that the GameNode object represents folders and EntityAttrib represents files. To...

How to make WPF pop-up windows not be hidden behind main application?

In a WPF application, I have buttons which pop up instances of windows. I click the first button and the first window pops up correctly in front of the main application. I click the second button and the second window pops up correct in front of the main application. However, the first window now moves behind the main application. Thi...

Localizing system menu control tooltips

I'm working on a multi-lingual WPF project that will be localized into many different languages. One issue we are currently having is localizing the tool tips on the minimise, maximise and close buttons. The tool tips seem to get localized when changing the OS language in Vista and Windows 7, however on XP SP3 the tool tips still appea...

Get a Framework element from a Storyboard

I have a reference to an instance of a Storyboard object, and want to get hold of the Framework element that it is attached to / animating. I haven't been able to come up with any way of doing this. For example, in the XAML below, can I go from a reference to the Storyboard to get hold of either the Label or the Grid <Grid> <Grid.R...

wpf: making textblock height expand when text gets too big for 1 line

Hello, I have a listview with an itemtemplate: <ListView x:Name="messages" HorizontalAlignment="Left" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="Black"> <ListView.ItemTemplate> <DataTemplate> <TextBlock Style="{DynamicResource h3}" Text="{Binding}" Margin="10" MaxWidth="850"/>...

Visually linking items in a grid

Hi all, Does anyone know how to draw a line between two items in a grid? I would normally use a canvas but it does not provide the layout I want. The grid is the ItemsPanel of an ItemControl object. Thanks, Adam ...

wpf - how can I hit test the scrollbars in the scrollviewer?

Hi, Can someone please tell me how to hit test the scrollbars of a scrollviewer in WPF? Thanks, Andy <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel> ...

Creating grid of hexagons

I have to do a "grid" like this: Harmonic table I'm trying to create a ListView with ItemsSource=List<Note> where every odd note in the list is moved on the bottom... Is the ListView the right control? How can I draw an exact hexagon with faces that is near next object? EDIT: hexagon drawing is solved... this is the xaml <Path d:Lay...

SerialPort reading cause error because of not owning thread

I have a simple WPF windows application trying to read a serial port with the System.IO.Ports.SerialPort. When I try to read the incoming data in the DataReceived event, I get an exception saying that I don't have access to the thread. How do I solve it? I have this in the WPF window class: Public WithEvents mSerialPort As New Seri...

How can I access the base parent of an object in a WPF hierarchy?

Deep inside my WPF object hiearchy I create a Window object. However, I want the owner of this window object to be the base Window object. I've tried "climbing up the tree" with the following type of code but this approach seems suboptimal: (((((((TabGroupPane)((ContentPane) this.Parent).Parent).Parent as SplitPane).Parent as Document...

Bind to an attached behavior on a Storyboard

I have created an attached dependency property for Storyboards, with the intention of enabling me to call a method on my ViewModel when a Storyboard Completed event fires: public static class StoryboardExtensions { public static ICommand GetCompletedCommand(DependencyObject target) { return (ICommand)target.GetValue(Comp...

How can I trigger a control event when a ListViewItem is selected?

I have an image that I want to show only when a ListViewItem is selected. The code I have isn't working, but I think it illustrates what I want to accomplish. <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate> <Image Height="20"> <Image.Style> <Style TargetType="{x:Type Image}"> ...

Windows Explorer control for WPF?

Hi there, Is there a way to have a Windows Explorer on WPF? The closes I can get is the Web Browser, but it's not really what I need. Please assist. Thanks ...

Wpf - relative image source path

I'm having problems setting the source for images in my Wpf application. I have an Image where the source is bound to the SourceUri property of the DataContext object, like this: <Image Source="{Binding SourceUri}"></Image> Now, I don't know what to set on the SourceUri property of my object. Setting the complete absolute path ("c:/e...

What did you find hardest to understand when learning WPF

What bit of WPF did you find hardest to understand or misunderstood for longest and how did you understand it in the end (please provide links etc). (I am asking this to guide my learning of WPF) ...

Tabbing between elements of a view in WPF/xaml

Hello, I'm trying to setup the tab keyboard control options on my current WPF project in xaml. Essentially, I've got a TextBox element within a view, within another view, within another view. Anyway, when pushing tab on the keyboard, it starts cycling through various elements of the container views and eventually goes to the TextBox I ...

In WPF, how to get RowDefinition object from the UIElement that belongs to it?

Take the following window layout for example: There is a Grid element defined. It has 3 rows. Each row has one Button element. How do I get the RowDefinition object of the Button it belongs to? Thanks. NOTE: By calling Grid.GetRow(Button element), I am getting the Grid.Row property of that Button element. I do not need that - instead ...

WPF: Getting a list box to stay put

I have this situation where I have a listbox which is being populated from a background thread (it's an address book and the data is coming from AD). The problem is that since the list is sorted (using CollectionViewSource) and also available to the user while more data is being retrieved, it's bouncing all over the place as new items a...

INotifyPropertyChange does not update converter-based values?

I have an image with source set by a ValueConverter. When the bound object raises a ProprtyChanged event (from INotifyPropertyChanged), the image does not change. I assume it is because WPF doesn't know what fields the converter looks at. How do I tell WPF to rebind/rerun this converter when a certain property changes? ...

WPF button Keypad contents generation from xml file

Hello all Can someone help? I have been sruggling to find information on how to populate the contents of each button in a wpf keypad that I've generated. It automatically generates the contents with the grid positon numbers. I need to fill the contents of each button from a node in a xml file. Thanks in advance. ...