wpf

WPF: Controlling timing of media

Does anyone have a sample on how to control timing of a audio clip in wpf c# I'm using this code to control timing of a animated disappearing of a image. DoubleAnimation AnimImage3Ut = new DoubleAnimation(); AnimImage3Ut.From = 1; AnimImage3Ut.To = 0; AnimImage3Ut.BeginTime = (TimeSpan.FromSeconds(12.0)); AnimImage...

How do I inject dependencies to user controls in WPF

What is the best way to transparently inject dependencies (using IOC container) to user controls in WPF? I assume that user controls are part of XAML for the window or other user controls. Also I think parent (whoever it is) should not be responsible for this. Solution for manually injecting dependencies from parent looks not clean enou...

How to call a method or use a variable from a different namespace in another class in another namespace in a xaml file?

How to call a method or use a variable from a different namespace in another class in another namespace in a xaml file? ...

WPF UserControl is not drawn when overriding MeasureOverride and ArrangeOverride

I have a UserControl looking like this: <UserControl MaxHeight="32" MaxWidth="32" MinHeight="25" MinWidth="25"> <DockPanel> <!-- some stuff --> </DockPanel> </UserControl> In addition to the min/max size constraint, I want the control always being painted with Width = Height. So i override MeasureOverri...

Why should I use the InkCanvas in WPF?

In my WPF application I have some drawing functionality. I have solved this using a Canvas and handling mouse gestures manually, and I also add the drawn Strokes (wrapped in InkPresenter) to this Canvas. Using Blend I suddenly discover that there is something called InkCanvas. According to Blend this is a control that "Defines an area ...

Determine who has focus in WPF Window

Hi, We are using WPF and have a window derived from a DockingLibrary. This window has a grid with multiple items in it, one being a WPF datagrid. We are using the M-V-VM pattern. When this windown is created and shown, none of the rows in this datagrid are selected. We can set the row to display as highlighted by doing something like: ...

IIS Smooth Streaming in a WPF application

How can I play IIS Smooth Streaming video in a WPF application. I know Silverlight has built-in support for it, but I can't find much information for WPF. Will the MediaElement control support this in WPF 4? ...

flex--->drag and drop videos.

how to drag and drop videos. Only drag and drop images are present in net i searched a lot so some body pls help. ...

C# XBAP QueryString (BrowserInteropHelper.Source.Query) Above 2080 Characters Problem

I'm passing a very long argument string to a C# XBAP application, and I'm using the BrowserInteropHelper.Source.Query method to read the argument string. But, for some reason, everytime the string for the arguments goes about 2080 characters, the application fails. Have I exceeded the maximum length? Any help would be fantastic! ...

How can I get to the value of my WPF UserControl DependencyProperty from UI Automation Framework?

Hi, I'm having trouble getting access to my WPF UserControl DependencyProperty values through the UI Automation Framework. I've used James McCaffreys article in MSDN as a starting point (Automating IO Tests in WPF Applications, MSDN March 2009), but I can only see properties etc in standard controls such as buttons. I'm assuming ther...

Can an ICommand's CanExecute method be redefined dynamically?

I've been unable to find any info on this, which seems like it could be the only way to solve a past unanswered question of mine on SO. However, I think this should really be a separate question now. I am wondering if there is a way to dynamically redefine an ICommand-derived class's CanExecute method. I'm still new to .NET and perhap...

Convert System.Drawing.Image to System.Windows.Controls.Image?

Is there a way in C# to do this conversion and back? I have a WPF app which has a Image control. I'm trying to save the image in that control to a SQL Database. In my Entity Model, the datatype of the picture column in my database is a byte[]. So I found a method to convert a System.Drawing.Image to a byte[] and back. But I haven't ...

Applying a style to a gridview

I have been tearing my hair out all afternoon on this, hopefully someone can help me. Bear with me on this one. I have a number of styles in my App.xaml which transforms a gridview, the code looks like this. <Application.Resources> <Style x:Key="{x:Static GridView.GridViewScrollViewerStyleKey}" TargetType="{x:Type ScrollV...

Is there a book for learning MVVM and WPF at the same time?

I am trying to learn MVVM and WPF, but most WPF books seem to teach you how write your software the wrong way. So is there a WPF and uses MVVM for its examples? ...

Any way to make WPF Adorner ignore mouse?

Is there any way to make WPF adorner ignore mouse entirely so that the UIElement behind the adorner still gets mouse events as if the adorner does not exist? ...

Equivalent of PostMessage in C# to synchronize with the main thread with MVVM?

I must be retarded with searching, because here's another seemingly common problem that I haven't been able to solve. Here's my problem -- I am using WPF and MVVM, and I have a statemachine that executes in the model. If an error occurs, I need to pass information up to the ViewModel to display the error. This part seems to work okay....

MediaElement Markers Missing in WPF

I see that there is a Markers Property on the MediaElement, but this seems to be available to the Silverlight MediaElement, not the WPF MediaElement? Can you help me with what I'm missing? I'm trying to add Markers to a WPF MediaElement, to play a video and show popups based on the timeline. What should I be using in place of the Missi...

WPF tooltip best practices

I'm about to change my application to include tool tips for all buttons, combo boxes, etc. I was wondering if there are any recommendations on doing this. For every control I'd like the tooltip to show the control's name in bold, followed by the description. I want to keep the style separated from the control, so I can change the tool...

WPF window on closing

I want send some data on server, before window close. I use event closing, but it doesn t wokr. Where is a problem? private void Window_Closing(object sender, RoutedEventArgs e) { _obj.CloseConnection(); } ...

WPF Datagrid deselects row when control is disabled

I have a program in which a user selects a row in a Datagrid and then clicks a "Start Recording" button. While "recording" is happening, they are not allowed to change the value selected in the datagrid, so I set IsEnabled to false. However, when the datagrid is set to be disabled, it deselects the selected row, which screws up any bindi...