wpf

WPF + IoC: "Specified Visual is already a child of another Visual or the root of a CompositionTarget."

[Edit: Rethinking architecture along mvvm lines made this problem largely fall away - thanks @kent] Using Spring.NET + WPF. Load two WPF buttons in the config: <object name="Button1" type="System.Windows.Controls.Button, PresentationFramework" > <property name="Name" value="Next" /> <property name="Width" value="200"/> <property...

How can I find out when a new UIElement is added in Silverlight

I am designing a user control in sliverlight that inherits from canvas. It is necessary for me to find out when a new UIELement is added to Children property of MyBase but there is no event like "ItemAdded". Since I want to animate the children of my canvas, I can not use LayoutUpdated event (It is hit a million times). ...

WPF Frame accessing parent page controls

I have a WPF page that contains a Listbox and a frame. The frame has various pages loaded into it determined by the selection within the Listbox. Each page within the frame has a variety of different input boxes and has a Save Cancel button. When the Save button is clicked I need the content to be saved to the database and the Listbox i...

How to have no/one window title and have a different title for the task bar?

Windows Explorer in Windows 7, and maybe Vista too (can't rememmber), does not have a title in the window. but does have a title (some text) in the taskbar. Is this possible to reproduce in C# (wpf or winforms)? either through the framework or introp. I want to have a window that says "Options" in the taskbar but the window itself does...

No, an Adorner DOES NOT automagically take the DataContext of its AdornedElement in WPF.

Original question: Does an Adorner automagically inherit the "DataContext" of its "AdornedElement" in WPF? ...

Writing a WPF Grid

I need to write a WPF excel-like grid control. I'm new to WPF and can't quite work out where to start. Should it derive from UserControl, FrameworkElement, or something else? I need it to have horizontal and vertical scrollbars and a content area. Does that mean my grid control should have a DockPanel with the scrollbars, then another ...

How to render WPF animation as a video frame by frame?

I've created a nice effect that I like in WPF, I'd like to be able to "record" this effect. But it is choppy during run-time. Is there a way I can convert it to a frame-by-frame process and save it as a video myself instead of trying to record it during playback? Basically I'd like to render WPF as a video, or list a series of frames s...

How to display webcam images captured with Emgu?

Hello, I'm currently working on a project that use Facial Recognition. I therefore need a way to display the webcam images to the user so he can adjust his face. I've been trying a lot of things to get images from the webcam using as less CPU as possible: VideoRendererElement WPFMediaKit DirectShow-Lib But none of them were fine......

Create a transparent hole inside a window's background - WPF

I have a window with these values: WindowState="Maximized" AllowsTransparency="True" Opacity="0.5" WindowStyle="None" This window is coming on top of other window (as a pop-up) with content on it on a specific location. I have a new requirement. This window have to show a rectangle area from the window below. In other words, i have t...

C#: Making an Installer that installs both a WPF application (ClickOnce) and a Windows Service

I currently have a VS Solution with 2 projects: a WPF application and a Windows Service. Now, I have managed to get ClickOnce working in installing my WPF application, but I also want a Windows Service to be installed (the one in the project) during this installation. I have found ways how to programmatically start a windows service ...

Why am I getting an exception raised from Spring.NET on the call to ContextRegistry.GetContext()?

Even though the solution is so obvious I should have never have posted this, I'm leaving it up as a reminder and a useful point of reference to others. I've got the following in my app.config file: <sectionGroup name="spring"> <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/> <section name="o...

Render Mathematical equations in WPF - design suggestions?

I want to display Mathematical equations in WPF. I'd like to display this using native WPF objects (i.e., NOT from previously rendered equation images). For example, variable X would be the glyph X, and so on. What are my design options here? Is anyone aware of any library that does this? Or is DYI'ing the only way out? ...

WPF ListBoxItems with DataTemplates - How do I reference the CLR Object bound to ListBoxItem from within the DataTemplate?

I have a ListBox, that's bound to an ObservableCollection. Each ListBoxItem is displayed with a DataTemplate. I have a button in my DataTemplate, that when clicked, needs a reference to the member of the ObservableCollection it's part of the DataTemplate for. I can't use the ListBox.SelectedItem property because the item does not become...

How to clear the Console in c#.net?

Just that. I found a similar question here : http://stackoverflow.com/questions/377927/c-console-console-clear-problem but that didn't answer the question. UPDATES : Console.Clear() throws : IOException (The handle is invalid) The app is a WPF app. Writing to the console however is no problem at all, nor is reading from. ...

Attempted to read or write protected memory.

I am trying to learn WPF. I am following along with a book(WPF in 24 hours) and occasionally I get the following error: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted. When I click "OK" the application continues to run as if nothing is wrong.So far I have worked with XAML o...

Show Images in WPF ListBox

Hi All, I'm trying to display images stored in MSSql Db as varbinary, when execute my code it just hangs itself Code is as follows... XAML <Window x:Class="ImageList.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namesp...

Using BitmapFrame for metadata without locking the file

I've found the common way to get image metadata in WPF is to create a BitmapFrame object and inspect the Metadata property on it. However I can't seem to create a BitmapFrame object that fulfills these two requirements: Does not lock the file Does not throw weird, undocumented exceptions when given certain files Using these lines see...

How to align TexBlocks in WPF Expander Header

Hi, I have Multiple Texblock in Expander Header. I want these TextBlocks aligned to Left, Right and Center. How can i achieve this? Please Help... Thanks Sharath The Text in Red should be left aligned, the one in blue should be center aligned and the green should be right aligned Please copy the code in XAMLPad.Exe ...

Capturing the windows key in c# (wpf).

I have written a small program displaying sounds and images on the screen when pushing any button. I always start it when one of my little kids crawls onto my lap and start hitting the keys, of course, randomly. It works fine except for 2 keys, one of them being the ON/OFF switch, the other being the Windows-key. (the CTRL-ESC equivale...

Animated GIF problem in WPF

Hello all, <MediaElement LoadedBehavior="Play" Name="imgScan" Source="Images\Pre_Scan_RealImage.gif" Grid.Row="1" /> I have added above code in my WPF from which include animated GIF image, the problem is whenever form load I don't find any of the Image displayed on form, any suggestions ??? <Image Name="imgScan" Source="Images\Pre_...