wpf

How to Stretch WPF Tab Item Headers to Parent Control Width

Is there a way, in XAML, to cause the tab item headers to stretch across the width of the tab control. For example, I have three tabs, red, blue and green. I have a tab control with it's width set to auto, the tab headers will only fill up part of the space above the tab content, I want them to fill up all the space. I have an idea how...

Binding ElementName. Does it use Visual Tree or Logical Tree

Having {Binding ElementName=foo}, will it lookup visual or logical tree? http://blogs.msdn.com/mikehillberg/archive/2008/05/23/Of-logical-and-visual-trees-in-WPF.aspx When does the logical tree matter? When looking up a name, such as in {Binding ElementName=Foo}, the search walks up the ancestry looking for a name scope, ...

How do I databind a control in an item template to the item itself, and not one of its properties?

Hello, I've got a WPF ListBox that's databound to an ObservableCollection of type Employee. In the ItemTemplate, I'm binding the content of controls to various properties, as normal. But for one of the controls in the template, I've made a custom converter class that it uses, and I'd like the converter to get passed in the Employee obj...

What can cause a WPF application to crash with an AppHangB1 Problem Event Name?

The program I'm currently working on occasionally hangs with an AppHangB1 problem event. I have traced it to a specific series of actions, but it seems to be a type of heisenbug, as whenever I step through the code, it doesn't manifest itself. And once the program hangs, I can't pause the program to see where it is hung in Visual Studi...

ItemsSource + Converter + Treeview wont update

This one is fairly complex, hopefully I can make this clear enough for somebody to help me out. I have an object lets call it a Manager, the Manager has a collection of people that he manages, the people all implement IPerson, but different types of people have different properties. I want to display this manager in a tree, and under the...

Load WPF styles (static resources) from an external assembly

I have a few WPF applications and I want all my styles to be in a shared assembly instead of declaring them in each application separately. I am looking for a way so I don't have to change all my Style="{StaticResource BlahBlah}" in the existing applications; I just want to add the reference to this style assembly, and delete it from th...

Best way to bind controls in two windows in master-detail situation

Assuming that you have two windows where one window has a listbox and the other window should have the detail information for an item currently selected in the listbox. In one window this is easy enough to do but how would one do this with two windows? Unfortunately, two windows is the only option here. ...

WPF UserControl to DLL Programatically

I am generating a WPF UserControl in code that I would like to save as a DLL for use in a different application. The process of saving the DLL needs to be fully automated. Would it be better to try to do this with System.Reflection or by shelling out to csc? Or, is there an even better way to do this? John ...

WPF exception running animation in another class

Hi I can run an animation from the main window class but if I try to run the same code from another class in the same namespace I receive an exception in the storyboard begin function this is the exception: No applicable name scope exists to resolve the name 'DefaultGroup'. this is how I set the storyboard target and property Storyboard...

Proper way to display pop-ups using WPF M-V-VM pattern

I had a question about the VM responsibilities when it comes to pop-ups. When an app is popping a message box or some kind of dialog (with MVVM), the two options that we have are: putting UI (ShowDialog()) code in VM which seems bad have VM send some kind of event that UI can subscribe to and display a dialog in the code behind (but...

WPF usercontrol

Hi all, I facing very huge problem now, that is I have usercontrol (created by me) which I have added on to a window... on click of button I wann show another usercontrol on window, total how can I access the window object in my control (usercontrol) Thanks all ...

WPF Bind DateTime to Date and Time EditFields

Hi, i am trying to build a gui that includes editing a DateTime value of an object. The DateTime Property has binding to a DataPicker and a normal TextBox for the Time. When i change the value in the Time TextBox the value wirtten in the DateTime Property is Today with the entered Time instead of just updating the Time, preserving the...

Why would INotifyPropertyChanged only fire when at least TWO characters are changed?

I finally got a Silverlight MVVM example to work so that when I change the values of first name and last name text boxes, the full names change automatically. However, and strangely, my model which inherits from INotifyPropertyChanged is only notified if I change at least 2 characters of either the first or last name. if I change "Sm...

Best way of upgrading .NET windows controls to WPF controls?

We are about to upgrade a C# windows application (1.1) to WPF from windows controls (3.5). Do you have any suggestions on where to start Any tips & tricks? What to avoid? The window controls (1.1 .NET) are present in a separate project within the solution together with our "entrypoint" and "process controller" for the application. ...

WPF 3D - Fit ModelVisual3D into the camera's field of view?

I have a cuboid who's dimensions are imported from XML so i need to be sure that no matter what the size of the model, the camera can always see all of it. This is for preview purposes. I'll likely render a caption over the top showing the scale for clarity. I think i need some function which will tell me whether the ModelVisual3D fit...

Load a ResourceDictionary from an assembly

I've got an assembly somewhere on the file system, e.g. "C:\temp\test.dll". In that assembly there's a ResourceDictionary, e.g. "abc.xaml". How can i get that ResourceDictionary? Maybe there is a way using Reflections? I didn't find a solution so far. Thanks in advance! Edit: Just wanted to add that I want to access the Resources in t...

What are your strategies of binding the DataContext in MVVM?

These two 1-hour videos show step-by-step how to use the MVVM pattern to build simple quiz applications in both Silverlight and WPF: Implementing Model-View-ViewModel in Silverlight Implementing Model-View-ViewModel in WPF What amazes me about these is how different they are structurally, for instance, how they use DataBinding: In th...

WPF: Disappaearing icons

I have several icons which are declared in Window.Resources. They show up fine the first time they need to appear (eg: a Menu is clicked, the MenuItem icon works), but after another Menu (eg: a context menu) is shown, the original icon disappears and does not return. It's as though the last element which used the icon for the first time ...

Is WPF the future of user interface design? Should I learn it now?

There has been a lot of talk surrounding the likes of WPF. I am wondering if WPF will become a new standard for graphical interactive user interface design. Is this where we are headed in terms of windows interfaces? Will it really take off like everyone says it will? See also Learning Windows Forms vs. Windows Presentation Found...

When does binding target get updated for complex paths?

When using databinding in WPF, the target dependency object gets updated when it is notified that the source has changed through the INotifyPropertyChanged interface. For example: <TextBlock Text="{Binding Path=SomeField}"/> The text field will change to correctly reflect the value of SomeField whenever PropertyChanged(this, new Pro...