wpf

WPF: What can cause a binding source to not be updated?

I have a situation I'm not sure how to debug. I'm hoping someone can suggest why it might not be working and point me in the right direction. I have a TIFF image from a database which is exposed as a property of type System.Data.Linq.Binary. I want to display the individual frames from that TIFF image in an ItemsControl so I've written ...

InvalidOperationException on object from a thread that's done

In a WPF application I had a BackgroundWorker thread creating an object. Let's call the object foo. Background worker code: SomeClass foo = new SomeClass(); // Do some operation on foo // Set some dependency property on the main class to foo this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate { SetV...

Visual Studio 2010 Beta 2 + ClearType

I was wondering: are you satisfied with the text-rendering in the Visual Studio 2010 editor (Beta 2)? On my primary monitor it looks very blurred, even when using font size 12! When using font size 10 or 11 it's horrible. Can the WPF text rendering mode be set explicitly for VS code window? EDIT: I am using Windows 7 x64 and my primary...

MDI Applications in WPF

I am working on a new .Net WPF project and will most likely be using the PRISM framework. One of the requirements that I have for the application is to have an MDI type user interface. I need a main shell with a header, footer and sidebar regions. The main workarea of the application needs to contain multiple tabs, with one tab for each...

Binding the display value of a Collection's Properties to a ComboBox

Hi all, Let me first describe my goal: I have created an object with 3 properties: start, end and time. I have created an ObservableCollection of 8 of these properties, so it looks like this: //C# internal class MyObjects : ObservableCollection<MyObjectSetting> { public MyObjects() : base() ...

Hosting Flash ActiveX control in WPF

I want to host a Flash animation in a WPF project. It is okay. But the problem is it shows in a tabcontrol. When I click second tabitem I want the flash animation to start. It gives this error: Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown. My codes are as follows: C# code. private void M...

XBAPs and MouseWheel events

I've got an XBAP hosted in FireFox, which works great. However, I cannot detect MouseWheel events ever! I'm guessing that FireFox is consuming them and not passing them down to the hosted app. Any ideas on how to work around this? ...

Accessing resources in Xaml across projects/dlls

Is it possible to reference Xaml assets stored in a ResourceDictionary (build action = resource) from another project? I would like to either merge the assets into the main project's resource dictionary or access them individual. For example: Project "MyResources" contains a folder named "Assets" which has a ResourceDictionary called...

WPF Trigger based on Object Type

Is there a way to do a comparison on object type for a trigger? <DataTrigger Binding="{Binding SelectedItem}" Value="SelectedItem's Type"> </DataTrigger> Background: I have a Toolbar and I want to Hide button's depending on what subclass is currently set to the selected item object. Thanks ...

WPF - Use a ControlTemplate resource within a Style

When creating a Style, is it possible to set the ControlTemplate property to a previously defined resource? For example, if I had the following in a ResourceDictionary: <ControlTemplate x:Key="MyControlTemplate" TargetType="{x:Type Button}"> ... </ControlTemplate> And then later wanted to use it in a Style like this: <Style x:Key="M...

Dynamic filtering with an ItemsControl combobox

Hi, I have this situation where I want to display a list of Administration objects and a ComboBox for each Administration. Inside this ComboBox I want a list with Employees belonging to this Administration, along with an empty option. So I need to filter based on Administration. So far I've come up with the following code (note: object...

make a WPF Popup not screen bound

The default behavior of a Popup is if it is placed where it would extend beyond the edge of the screen, the Popup will reposition itself. Is there a way to turn this behavior off? I have a Popup that the user can drag around the screen. However, when it gets to the edges it gets stuck. It gets stuck on the edge and stays there until th...

How to encode Video from Web-Camera into H.264 in C# ?

How to encode Video from Web-Camera into H.264 in C# ? What do I need MSDN if thare is any help on this. Open Source Libs/wrappers for encoding/decoding. Tutorials and blog articles on How to do it. Some examples of of how to encode into 3GP or FLV or some thing else (whith low size) would be more than apriciated!))) ...

Creating a WPF Custom Control

I'm currently creating a user interface using WPF and would like to display a pie-chart on my window. As far as I can see, this will involve creating a custom control - it is not a scenario in which applying styling or templating to an existing control will be sufficient. I've read several articles on custom controls and all of those whi...

define animations and triggers as reusable resource?

Is there a way to define an animation somewhere in xaml (eg. as a resource) once and then reuse it multiple times? I have a lot of independent brushes across differnt datatemplates that independently need to start the same kind of animation based on a datatrigger. Now since it seems that an animation has to define an Storyboard.TargetNam...

MediaStreamSource in WPF

Hi. I need to play a custom audio stream in WPF. I can deal with the mp3/wmv restrictions. The MediaStreamSource class seems ideal, but all the examples I have seen are Silverlight 3. Is there a WPF equivalent? Thanks Pete ...

WPF, Bad practice to put code directly after InitializeComponent?

Hi there, I was just wondering about something, i have a frame that loads pages and currently each page has a Page_Loaded method that will run each time the page is accessed. This is working great but i am noticing errors if i use the navigation to go to previously visited pages. Upon returning to a page; Page_Loaded is being called aga...

How to alter a visual state of a ControlTemplate without replacing it?

I want to define a ToggleButton that appears with red foreground (for example) when checked, rather than the default appearance of a pressed button. I see that the visual states are maintained as named elements inside the ToggleButton's control template. What is the easiest way to replace/remove/customize a visual state WITHOUT redefin...

Detect FlowDocument Change and Scroll

I want to detect (preferably through an event) when any content is added, changed, etc. in a FlowDocument and when it does I want to cause a FlowDocumentScrollViewer displaying the FlowDocument to automatically scroll to the end. ...

How do I theme windows like Google Chrome, with WPF?

You know how Chrome windows are super custom looking and what not, they have a custom title bar that has custom looking minimize/maximize/close buttons. How would I do this with WPF? ...