wpf

WPF, Prism v2, Region in a modal dialog, add region in code behind

I have a composite WPF application. In one of my modules I want to make a wizard and have the steps show up in a region so I can switch between the steps easier. Originally I had this wizard showing up in a tab region and the nested region worked fine. Now I want to make it into a modal dialog box, but after I open it the inner region ne...

Observable Collection Property Changed on Item in the Collection

I have an ObservableCollection. I've bound it to a ListBox control and I've added SortDescriptions to the Items collection on the ListBox to make the list sort how I want. I want to resort the list at ANY point when any property changed on a child element. All my child elements implement INotifyPropertyChanged. ...

WPF - Best Practice for the run-of-the-mill [Label:Input] Control

Hi, I am wondering, which is the best and quickest way to get the well known Label Input [or output, doesn't matter] combination in WPF. Its a simple Task, just think of a quick output of the "object" ME: Name - Christian Age - 28 Mood - Good I know, I can use a Grid with TextBlocks. But to be honest, the "short" XAML for this i...

Setting Command Target in XAML

I am having a hard time understanding the CommandTarget property for a RoutedCommand. Basically, I have some static commands that have implementations in a user control (not the window). I create a commandbinding in the user control. If I declare the button in the usercontrol, then I am able to use my routed event. However, when the ...

Can WPF print PDF and Office files directly?

How can I allow the user of a WPF application to print PDF, Word, Excel and Powerpoint files without opening them, i.e. show a ComboBox of all files available, user clicks on one, Print dialog opens, user clicks OK and it prints to his desired printer? ...

WPF CommandParameter in Textbox

Hi, I am using MVVM pattern and i have a textbox in parent window and want to send some text to the popup window which will appear on Textchanged. I tried using commandparameter but it is not working for me. Please help.. Thanks Sharath ...

How can I get this DataTrigger to work?

I want my TextBox to have a red background if the ViewModel property = "invalid". What do I have to change so this works? This version tells me that Background does not have a qualifying type name. <TextBox Width="200" Text="{Binding FieldEmail, UpdateSourceTrigger=PropertyChanged}"> <TextBox.Triggers> <DataTrigger ...

access-like data navigation in WPF?!

What would be the best way to build a data-navigation like in access-forms in XAML/C#? Should I build a user control (or even custom control) that I just bind to my collection in which I can put other controls? (hence this question: http://stackoverflow.com/questions/969835/c-user-control-that-can-contain-other-controls-when-using-it ) ...

[WPF] Custom binding class is not working correctly

Hi! Currently I'm playing around with WPF data binding and I came to an issue I dont understand. So I post the problem here, maybe you have and idea whats geoing wrong. At first: I'm working with Visual Studio 2008 under Windows Vista 32bit, the problem is also present in Windows 7 RC1 64bit, latest updates/service packs are installed e...

DependencyProperties where the value is not stored locally

I'm a little confused on creating a DependencyProperty for properties that depend on external sources. For example, in an ultrasound application I'm writing, I currently have the following in a Managed C++ wrapper (translated to C# for simplicity on here, implementing INotifyPropertyChanged): public int Gain { get { return ultrasoun...

What is the best way in MVVM to build a menu that displays various pages?

I want to build a simple application with the MVVM pattern. This application will have two main parts: menu on top content below The navigation will be simple: each menu item (e.g. "Manage Customers" or "View Reports") will fill the content area with a new page that has some particular functionality I have done this before with ...

BindingExpressing in WPF

Hi, How to use BindingExpression for Listbox? For textbox we use something like BindingExpression bindingExpression = txtbox1.GetBindingExpression(TextBox.TextProperty); Thanks Sharath ...

How can I bind a MenuItem to an ObservableCollection?

I've got this menu bound to an ObservableCollection called MainMenuPageItems, in which there are objects that have a Title property: <Menu DockPanel.Dock="Top"> <MenuItem Header="_File"> <MenuItem Command="{Binding ExitCommand}" Header="E_xit" InputGestureText="Ctrl-X" /> </MenuItem> <MenuItem Header="Code _Generatio...

WPF Listview empty text

How to show in the WPF Listview using the GridView an empty text (like in ASP.net), e.g. "please select a person" or "0 items founded"? ...

How to manipulate WPF GUI based on user roles

I am using C#'s Identity and Principal objects for role based security, and I am at the step of modifing controls shown based on roles the current user has. My question is what the recommended method is for enabling/disabling fields in a WPF window - showing/hiding fields dependent on Identity.IsInRole type calls. Can this be done in X...

WPF ListboxItem loaded multiple times

I have a trigger on a storyboard for my listboxitem where the trigger is 'Loaded'. It appears that every time the listbox scrolls the item gets the 'Loaded' event. I really only want the storyboard to run once, when the listboxitem gets displayed. I assumed that the Loaded event would only get triggered once. Any help would be great. ...

WPF Databinding and Styling based on Data in an item in an IList

I have a ListBox bound to a list of Items (for arguement, lets say its got a string and two dates Entered and Done). I would like to make the background color of items in the ListBox have a gray color if the Done DateTime is != DateTime.MinValue. Edit: Should I make a converter? and convert DateTime to a Brush based on the value of th...

WPF: animate a custom dependency property?

Hi everyone, Let's say that I've defined a dependency like this: public class MySampleClass {public static DependencyProperty MyDoubleProperty = DependencyProperty.Register("MyDouble", typeof(double), typeof(MySampleClass)); public double MyDouble { get { return (double)GetValue(MyDoubleProp...

Accessing to a XAML item from other XAML

Hello, I have a little problem. I have a window that the main content is a UserControl. The user control is a ItemsControl formatting a list. In the window, I have a slider that zoom the ItemsControl. The problem is that in the windows I have created the UserControl, and I have not direct access to the ItemsControl and if I zoom the Us...

Bind ContextMenu's MenuItem visibility to ListView selection

I have a user control with a ListView containing simple items from an ObservableCollection. I would like the ContextMenu of that ListView to contain items depending on what's selected in the ListView. If no item is selected, some MenuItems should not be visible. My converter isn't even called when I open the ContextMenu. The binding se...