wpf

Loading a form into InfoPath FormControl with parameters

Is there a way to pass parameters into an InfoPath FormControl hosted in a WinForms/WPF application the way they can be passed via a URL and the command line? Our forms depend on parameters passed to them on startup to execute a custom data connection to pre-populate them, but the control does not appear to support parameters. A bit of...

MVVM: Binding radio buttons to a view model?

I have been trying to bind a group of radio buttons to a view model using the IsChecked button. After reviewing other posts, it appears that the IsChecked property simply doesn't work. I have put together a short demo that reproduces the problem, which I have included below. Here is my question: Is there a straightforward and reliable w...

WPF: How do I use EventSetters with a Window Style?

I have styled a window to replace the standard Chrome and I want to handle the Activated and Deactivated events using EventSetters. I get an error "...'Activated' must be a RoutedEvent registered..." with this: <EventSetter Event="Activated" Handler="Window_Activated"/> However, this works fine in the same style. <EventSetter Ev...

Setting up binding to a custom DependencyProperty inside a WPF user control

I have a WPF UserControl containing a custom DependencyProperty named MyDP. I want to bind this to a property on my ViewModel (which is injected as the UserControl's DataContext). I know one way to do it by setting the binding in the UserControl's declaration in the parent window's XAML as such: <Window x:Class="MyNamespace.Views.Main...

What is the best way to databind a WPF control to a typed dataset?

I have a static, typed dataset that I am using within my WPF application that all the user controls must bind to. I want compilation to break if the dataset and the UI are out of sync. What approach have you found best to accomplish this? ...

Prevent WPF Frame from storing history in the stack

This seems like it would be an easy solution, but I'm wasting too much time trying to figure this out. Perhaps I am designing my application incorrectly (which might be the case), so please help me out if you have a better solution. I'm designing an enterprise level WPF application that looks a lot like Outlook with a Ribbon instead of...

WPF - FrameworkElement - Enumerate all decendents?

I have a FrameworkElement (really a ToggleButton) that has inside its content a Popup. I access it like this: ToggleButton button = (ToggleButton)sender; Popup popup = (Popup)button.FindName("popSelectIteration"); Usually this works fine. But sometimes popup is null. I am trying to find a way to debug this. Is there a way enumerat...

Design Question - OO food application

Say I have a number of usercontrols, each usercontrol inside a tabitem, inside a window. For example, let say this is a food collection application. Then we have tabs Fruit, Vegetables and Snacks. Each tab will show a list of food of that subject, and allow the user to add, delete, modify the food in each section. The food is stored in ...

WPF StoryBoard FillBehaviour

Hi all, I have been trying to get a simple few animations working in Blend where the user basically navigates through the application. However, I'm running into the problem where after you animate a value, you cannot change it again unless you change the FillBehaviour property to Stop Which means that I have to create a Completed even...

WPF - FindName Returns null when it should not

FindName is broken for me :( If you are an expert in such things I would love some help. The object I am looking for is there. I have proof. Here is the scenario: ToggleButton button = (ToggleButton)sender; Popup popup = (Popup)button.FindName("popSelectIteration"); popup is null but not always. Just sometimes. But even when it ...

WPF Expander in Xaml?

I want to make an ItemControl that provides some of its own children, and then when used can add additional children, similarly to the built in Expander class. However, in this example, the Header TextBlock is also removed. This is a rephrasing of a question I asked yesterday (http://stackoverflow.com/questions/2277309/wpf-usercontr...

Why would putting a no-op Converter on a Binding change its behavior?

I'm in the midst of testing a user control I've built, and I'm encountering something that's inexplicable to me. The control's an extension of the ComboBox that handles values of a specific custom type. It has a dependency property of that custom type that is the target property of a Binding. I've got a trace statement in the setter...

User selects something in combobox, something else is sent to dependency property

In my application the user can select how a date is displayed. Most of the standard datetime format strings can be selected. My problem now is that the average user doesnt understand the difference between "m" and "D". What I want to do is change this so that, as excel does, rather than showing the format string, I show how an arbitrary ...

Listbox doesnot display text

In my tabcontrol using WPF,C#.I entering text to listbox in one tabitem from the click event in tabcontrol.But the listbox doesnot display the text.When i debug i can find tht the listbox has count:1 here is the code: namespace Tabcontrol { public partial class PresetTab : UserControl //3rd Tabitem ,preset.xaml.cs { ...

Menu item opening and closing event

Hi experts, I want to handle an event, whenever the Submenus of a menu item opens. Same for closing. how can I do this? Thnks in Advance Regards, Jawahar ...

Add buttons with a wpf datagridtemplatecolumn based on a linq for sql table

I have a datagrid that I bind to a database table. Here is the XAML <dg:DataGrid Name="dgContents" Grid.Column="1" AutoGenerateColumns="False" RowEditEnding="dgContents_RowEditEnding"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Binding="{Binding name}" Header="Name"></dg:DataGridTextColumn> <dg:DataGridTextColumn B...

What is C# analog for ColorMatrixFilter in ActionScript?

What is C# (wpf, .NET) analog for ColorMatrixFilter in ActionScript? ...

How can I add a FlowDocument to a StackPanel?

I created the following class in order to have an easy way to display formatted text in a WPF document. However this solution returns a FlowDocument, and I am having trouble integrating this FlowDocument in my current application in which I was simply adding TextBlocks to StackPanels and WrapPanels and Borders, etc. How can I add the ...

WPF reporting control that integrates well with MVVM pattern ?

Is there any WPF control (commercial or not) that integrates well with the MVVM pattern ? Ideally the report would be another View for the ViewModel. ...

How can I add multiple FlowDocumentReaders to a StackPanel?

Thanks to Leom's answer I was able to add a FlowDocument to a StackPanel by wrapping it in a FlowDocumentReader. But now I have two problems: it seems only the first FlowDocumentReader is added and the rest ignored there is an unwanted margin that I can't get rid of How can I add multiple FlowDocumentReaders to a StackPanel without ...