wpf

Why do I get completely different results when saving a BitmapSource to bmp, jpeg, and png in WPF

I wrote a little utility class that saves BitmapSource objects to image files. The image files can be either bmp, jpeg, or png. Here is the code: public class BitmapProcessor { public void SaveAsBmp(BitmapSource bitmapSource, string path) { Save(bitmapSource, path, new BmpBitmapEncoder()); } public void SaveAsJp...

Make a Button Appear Focused When Not

The Find and Replace dialog in Visual Studio is a perfect example of what im trying to accomplish. Notice how the "Find what" text field has keyboard focus but the "Find Next" button appears bluish as if it has keyboard focus also even though it does not. How can I accomplish this myself? I've tried messing with FocusManager and Focus...

WPF A good way to make a view/edit control?

Hi, this is just a question to discuss - what is the best way to make a view/edit control in WPF? E.g. we have an entity object Person, that has some props (name, surname, address, phone etc.). One presentation of the control would be a read-only view. And the other would have the edit view for this same person. Example: <UserControl x:...

How to force editing of a DataGridComboBoxColumn?

Hi, I can expose a DataGridComboBoxColumn on a grid, but the user must click it twice to show its drop-down list (the first is to gain focus and enter in edit-mode). How can I force programatically to show the drop-down list? ...

WPF Binding issues

I have WPF window which binds a local Dependency property to a property of my usercontrol. So now I see the value which the window gave me in my usercontrol. I achieve this by setting DataContext of window to the window itself Now once the window is loaded i set the DataContext of usercontrol to a ViewModel class, and at some point of t...

can i fetch the xaml button style on my dynamic button?

hello all i have a problem i have some dynamic button and i want to put some style on it like my other button(Xaml button).how can i fetch the xaml code using c#? but it gives N ERROR buttonlanguage.Style = (Style)Application.Current.FindResource("Glassbutton"); ...

Why do we need a Grid Control?

I don't know why we need a grid when building a Windows form! What can't we do without a grid control in a Windows form then? Please discuss. ...

CommandManager Executed Events don't fire for custom ICommands

The WPF CommandManager allows you to do the following (pseudo-ish-code): <Button Name="SomeButton" Command="{Binding Path=ViewModelCommand}"/> And in the code-behind: private void InitCommandEvents() { CommandManager.AddExecutedEventHandler(this.SomeButton, SomeEventHandler); } The SomeEventHandler never gets called. To me thi...

Grouping datagrid in silverlight?

Hi How we can grouping data-grid in silver-light with xaml? (I used silver-light 4 ) ...

simple plot algorithm with autoscale

I need to implement a simple plotting component in C#(WPF to be more precise). What i have is a collection of data samples containing time (X axis) and a value (both double types). I have a drawing canvas of a fixed size (Width x Height) and a DrawLine method/function that can draw on it. The problem I am facing now is how do I draw the...

WPF/Silverlight performance while using GPU intensive applications

I might be mixing apples and oranges in this question since I'm noob in mentioned areas, so please try to understand what I mean. I read that WPF (and Silverlight, as an extension to it) uses GPU acceleration to render itself on the screen. If so, what happens when I have GPU-intensive application already running (say, game in windowed...

WPF ListView groups repeat column headers

Is there a way to repeat the column headers inside each group of a ListView.GridView when using a grouped CollectionViewSource as the source of the ListView? I am using the example at http://msdn.microsoft.com/en-us/library/ms754027.aspx which uses an Expander control to display each group. I would like the column headers to appear in...

How can i detect mouse pointer on my wpf user control??

Hi All, I am using some animation on my user control code behind. double height = canMain.ActualHeight - marqueeList.ActualHeight; marqueeList.Margin = new Thickness(0, height / 2, 0, 0); DoubleAnimation doubleAnimation = new DoubleAnimation(); doubleAnimation.From = -marqueeList.ActualWidth; doubleAnima...

WPF DataGridTemplateColumn shared template?

Hi I have a datagrid that has a number of datagridtemplate columns that are all identical apart from they each have a different datacontext on the template's stackpanel. <toolkit:DataGridTemplateColumn Header="Col 1"> <toolkit:DataGridTemplateColumn.CellTemplate> <DataTemplate> ...

Time validation in TextBox. Validating a textbox for some regular expression.

I've to make a textbox(WPF) for entering time with validation. I want to enter a regular expression validation for time (6:12 am). ...

WPF menus with shortcuts and custom RoutedCommand

Im new to WPF so i might be missing something. I have a simple function in my MainWindow class called StartService. I wanted to add a menu item "Start Service" with a shortcut Ctrl+S to my application. I had to do the following: In my MainWindow class i had to define: public static RoutedCommand StartServiceRoutedCmd = new RoutedComma...

Memory leak in WPF app due to DelegateCommand.

I just finished desktop apps written in WPF and c# using MVVM pattern. In this app I used Delegate Command implementation to wrap the ICommands properties exposed in my ModelView. The problem is these DelegateCommands prevent my ModelView and View from being garbage collected after closing the view. So it stays larking until I terminate ...

Way to implementing Search functinality on a Window

I am working on a (WPF + C#) application. I have to implement search functionality. It will allow to search all the occurrences of a particular string on the specific part of Window. What can be the best way to do this? ...

What should I use to replace the WinAPI Beep() function?

I've got a Visual C++/CLI app which uses beeps to signify good and bad results (used when the user can't see the screen). Currently I use low pitched beeps for bad results and high pitched beeps for good results: if( goodResult == true ) { Beep(1000, 40); } else { Beep(2000, 20); } This works okay on my Vista laptop, but I've...

Drag and Drop as Multitouch event in WPF

Hi, I´d like to drag and drop objects in wpf solution via multitouch gesture. I get two userControls. I am able to drag an item from userControl1 and place it anywhere in my application. It sounds good so far, but here is the problem: If I move userControl1, the dragged and placed item is going to move with userControl1. That means eve...