wpf

How to get the items from the node WPF treeview?

TreeView: -MainNode -node0 data01 -data02 data021 data022 data03 -node1 data11 -node2 data21 Event SelectedChange; As the choice of a node containing child nodes to get the final data? For example: selected node node0 receive data (data0...

When are ListBoxItems created for ListBox?

I have a ListBox that I bind to an ItemsSource, like this: var foos = new ObservableCollection<Foo> { foo1, foo2, foo3 }; var listBox = new ListBox { ItemsSource = _foos }; Now I want to do some operations right away on the ListBoxItems that holds the items, but they don't seem to be created right away. Are they? Is there some event ...

Handling the window closing event with WPF / MVVM Light Toolkit

I'd like to handle the "Closing" event (when a user clicks the upper right 'X' button) of my window in order to eventually display a confirm message or/and cancel the closing. I know how to do this in the code-behind : subscribe to the "Closing" event of the window then use the "CancelEventArgs.Cancel" property. But I'm using MVVM so I...

Silverlight DataGrid add Arrow to the right of the DataGrid near selected row?

Hi All I have master DataGrid and detail DataGrid. I need a arrow beatween them align to selected row in master? [ Master ] [ Detail ] [ row ] [ row ] [ row ] [ row ] [ selected row ] > [ row ] [ row ...

How can i get the real current height of a stackpanel?

Hallo, i want to make a custom stackpanel in WPF, which shall automatically resizes his childs to a certain size depending on the panels height. But the panels height is dynamic because it stretches to his parent. When i want to get the height (i tried all possibilities, see code), it is always 0 or not defined, although in the build so...

Notification when rendering a Visual in WPF is complete

Is there a way to get notified (e.g., by an event) when a Visual has been (re-)rendered? Basically, I would like to take a screen shot whenever a Visual's appearance has changed. I assume the rendering thread is taking care of this in the background. I am trying to avoid grabbing a screen shot periodically since I am only interested in...

Auto resizing wpf elements with scroll bars (Rich text box, list box) vb

Hey guys, I'm having a problem where I have elements such as Listboxes and Rich Text boxes that I want to set to size automatically in xaml according to the size of the window, but I only want it to resize to the size of the window and then put scrollbars if the content is any bigger than that. Unfortunately, the only way I can get scr...

Restrict Silverlight/WPF Behavior visibility

In Silverlight (and probably WPF), when I define a System.Windows.Interactivity.Behavior<T> for e.g. an ItemsControl, like public class SomeAwesomaticBehavior : Behavior<ItemsControl> { } it will appear in Visual Studio's XAML editor (and probably in the Designer too) even for ordinary, non-Items-Controls and throw nasty runtime excep...

Wpf 4 DataGrid Column Binding Problem

I have created a datagrid with columns bound to an observable collection. All works well except for a column which is bound to a nullable decimal property from my business object. If I use <DataGridTextColumn Binding="{Binding Path=BaseUnitCostValue}" Header="Unit Cost Value" MinWidth="100" /> as my column definition all works well,...

Tap-And-Hold Event on ScatterViewItem

Hi, I can't find infos on how to receive custom gestures on ScatterViewItems. I want "Tap-And-Hold" to invoke a function in the class behind my template. ...

Binding Observable collection

I have a collection in the main window and I want to show it on a grid in a user Control, What is the right MVVM way to do that ? I've done an observableCollection in the MainWindow And bounded it to an observableCollection in the usercontrol. and in the user control the grid is bounded to the collection. it doesn't work :( /// <su...

Can I change the Thread Affinity (Dispatcher) of a Control in WPF?

I want to create a control which takes a while to create (Pivot) and then add it to the visual tree. To do this i would need to change the dispatcher of the control (and its heirachy) before adding it to the VisualTree. Is this possible? Are there any implications of walking the controls trees and setting the _dispatcher field via refle...

WPF calling WCF with Windows Authentication - Not working

I am developing a WPF application in .NET 4.0 which calls a WCF Service hosted on the server developed in .NET 4.0. I want to use windows authentication for this purpose and it seems that it is not working and keep on giving me following error. The provided URI scheme 'http' is invalid; expected 'https'. Parameter name: via I...

Mixing WPF with a WinForm application?

My fairly large WinForm application needs a GUI overhaul, but I can't afford to do it all at once. I need to know if I can slowly add WPF into it, and if so, how? Can I add WPF dialogs? Can I add WPF 'panels' within a WinForm so that I can embed WPF elements? EDIT Can I do the opposite and put WinForm dialogs in my WPF application? ...

Prevent resize of content in WPF

I have created a data template for a data class. The width of the grid created by the datatemplate is bound to a property in the data class, ie, the size of the control matters. I am creating a list of the data class objects, and adding them to an items control in MainWindow. Update: I would like to line up the controls from the data ...

How can I stop the Enterprise Library caching block from persisting changes to data I've retrieved from it?

What an awkwardly worded question, you're thinking? When my application loads, it goes to the database and gets several different lookup tables worth of data and creates .NET Lists for each one and puts them in cache. For example, "Status". List at this point: On, Off When I retrieve the List of Statuses from the cache, I add another...

Iteration problem with Canvas.Children

I'm iterating through all the children of a given Canvas object. The trouble is, it's only impacting one of the two children. The other iteration I have in another similar event is working just fine. I've got this so that you can drag the elements: private Point lastmousepoint; private void Window_MouseMove(object sender, Mou...

View visibility is not changing

I have a Shell holding 2 Views. They both use the same viewmodel, in fact the shell uses the same viewmodel as well. I have 2 buttons in the shell that are supposed to change the visibility of the the 2 views. It appears that even though the command is firing, that the value is being changed and that i have onpropertychanged configured c...

WPF using ResizeGrip to resize controls

I want that the user can resize a control by draging a resize-grip on the lower right border. With the ResizeGrip there seems to exists the perfect control for achieving this, but I don't see what is the plan to use this control. It does not derive from Thumb (however in msdn is written that it is an "implementation" of it), and does als...

WPF control containing an IDisposable member

I have a member in the WPF code behind that is disposable (meaning it implements the IDisposable interface) I do not see any Dispose method I can override from UserControl in WPF so I can dispose of the member in my wpf usercontrol What is the correct way to dispose of a member in a WPF usercontrol? It's a usercontrol that wraps a pr...