wpf

CollectionViewSource CurrentItem

Hello I am using a CollectionViewSource in a dialog view model that has various filtering requirements, which works fine. I also maintain the equivalent of the selected item in a property (SelectedProject), and I'm wondering if I could / should do away with it since the View will know the current item. My data binding looks like: <L...

Resizing Border control

I've got controls strewn around a Canvas that the user can manipulate, and I'd like to make it so that the user can resize these controls by dragging a border edge. I could write a custom control, but before I dive into that, I'd like to find out if anyone has solved this problem already. ...

How do i get the text value from a ComboBox in WPF?

This may be something covered in C# 101 but I haven't been able to find an easy to understand answer to this question anywhere on google or stack overflow. Is there a better way to return a text value from a combobox without using this crappy work around I came up with? private void test_site_SelectionChanged(object sender, SelectionCh...

What's new in .net 4 for MVVM?

Does .net 4 add anything new for working with MVVM? ...

Problem with richtextbox.

When I first run my program and type some text in the richtextbox, if I press enter, which causes the carat to move to a new line, and then press backspace instead of going to the previous line it just moves back a space even though I haven't typed any text on this new line. I can't figure out what is happening. What am I doing wrong? An...

How can I bind an image MouseDown event with a RoutedUICommand

I have a RoutedUICommand that can be bind to multiple controls in xaml. I have a few Button controls and an image which should be bound to this Command. It's very simple to bind a command with buttons like <Button Name="btnAction1" Command="local:MainWindow.Command1"/> But I am unable to find a way to bind a mousedown event of image ...

What's the best way to handle navigation in a WPF application following the MVVM pattern?

I've seen this done inside of an event handler directly behind the .xaml file however it doesn't seem like this would follow the MVVM pattern: MainApplication.mainFrame.Navigate(new HomePage());. Is there a better way for handling navigation with the MVVM pattern perhaps in the ViewModel? or in the XAML? ...

How do I apply a ViewModel to the UserControl inside of a Page?

Doing something like this: <DataTemplate DataType="{x:Type vm:AllCustomersViewModel}"> <vw:AllCustomersView /> </DataTemplate> works in a ResourceDictionary for when I want to apply a ViewModel to a UserControl as root, but how do I the same thing when I have a UserControl inside of a Page? Would I create a ResourceDictionary for all ...

wpf treeview HierarchicalDataTemplate get child control

i m using this article http://blogs.msdn.com/delay/archive/2009/09/23/if-it-walks-like-a-duck-and-talks-like-a-duck-it-must-be-a-treegrid-a-simple-xaml-only-treegrid-ui-for-wpf.aspx to have hierarchical data... i am having treeview which contains grid and that grid contains textboxes... i just want to hide/show some columns at runtim...

Why Silverlight Out of Browser over WPF Desktop App?

is there any reason why one might want to select Silverlight Out of Browser option over a pure WPF Desktop app? i guess one might be easy to port to a web app? i guess a pure WPF app will provide more performance and features? ...

How to mute Windows with WPF?

I am learning C# and WPF and had an idea for a little utility. I want a big red button that will do only one thing: completely mute/un-mute all Windows sounds (system beeps, WMP, DVD player, etc...) I've explored the object browser in VS 2008 but can't seem to find what I need: A mute that will affect all of Windows. Is it System.Window...

Make an UI element transparent to mouse events

I have a lot of UI elements placed inside a canvas. Some of them are not supposed to handle mouse events while they can overlap with and cover other elements that must handle mouse events. When a mouse event occures, I want it to pass throuh all the elements that are not supposed to handle it to reach an element that might be covered by ...

How create WPF scrollbar to look like iTunes cover flow scrollbar?

I would like to create a scrollbar in WPF that looks like the one seen in iTunes cover flow. See scrollbar image below, which also shows the reflection of the album art underneath the scrollbar. Below is a basic scrollbar control in xaml. <ScrollBar Name="scrollBar1" Height="24" Width="Auto" Orientation="Horizontal" Smal...

DataGridTextColumn event binding

What is the simplest way to bind an ICommand to a DataGridTextColumn that will handle a user double click on that column without code behind? Can I somehow expose an underlying FE and do it all in the XAML? This particular column is read only and here is the xaml for it: <dg:DataGridTextColumn Header="Number" Binding="{Binding Business...

WPF Enable Disable Controls.

Hi, When I disable a control in WPF, like say a Menu item, like MenuItem aMenuItem = ... aMenuItem.IsEnabled = false; the text in the MenuItem is still active, that is it is not grayed out as you would expect when items are disabled. Is there a simple way to do this not only for Menu items but for any WPF control? Thanks ...

Handling fatal exceptions in ViewModel/Model

I have an application written using the M-V-VM approach. The data access is done in the Model. If a fatal error occurs here (for example, the connection to the data source is lost), and Exception is thrown. This Exception bubbles up to the ViewModel. However, because the original trigger of the data access was a data binding, WPF swall...

How to give title to WPF pages

How to give title to WPF pages It is possible to give the title to WPF window through XAML code itself at design time and it is showing the title to window at runtime. the code in the XAML is like Window1.Title="FormulaBuilder" For the WPF pages also it is given in the XAML code like Page1.Title="EmployeeMaster" But it is not showing...

Published Application in ClickOnce does not show updates

I am creating a WPF application and publishes it on the IIS. However when I am re-publishing the application since I do have code and UI changes, it doesn't show the changes on the application when I run it. Anyone encountered this before? ...

MVVM best practice to pass Dispatcher to the ViewModel

I suppose to be able to access the Dispacher that belongs to the View I need to pass it to the ViewModel. Bu the View should not known anything about the ViewModel so how do you pass it? Introduce an Interface or instead of passing it to the instances create a global dispatcher singleton that will be written by the View? How do you solve...

Fill WrapPanel from List

Hello! Help to understand. How to fill the panel from List. I want to get in the WrapPanel list of buttons and dynamically bind events to them. Thanks! ...