wpf

System Idle Detection.

I want to detect if the system is idle, ie: user not using the system. I want it like the Windows Live Messenger it changes automatically to away when I leave the computer for a time like 3 minutes, I want to set this time within the code. I`m working on the WPF under C# environment using both visual studio 2008 and 2010 so if here is a...

Control's parent is null when placed inside a ContentControl

I've got a simple control derived from ContentControl with 3 properties. My problem comes when I try to perform a control.TransformToVisual() with a control that is placed inside MainContent. It always brings up an ArgumentNullException. My guess is this due to the control having a null Parent property. Is there a simple way to way aro...

ContentTemplateSelector and Choose Template based upon the ListBoxItem Selected Item

Hi All, I have a XMLDataProvider Static Resource as for my Data listing some products. I have two Controls as Master Detail scenerio 1) ListBox which lists all the Product Titles and 2) COntentControl which displays the Product details. Now its working fine at the moment but the ContentControl is using a hard-coded Template. What I wa...

How to animate ScaleY when Element becomes visible

I'd like to make a WPF UI Element appear to expand vertically when its Visibility property transitions to "Visible". I don't want to hard-code the Height in the animation since I'd like to apply this animation to any UI Element as a Style. So, I'm trying to use ScaleY but am not having any luck. Here is the XAML for the style and the lis...

How do I put a border around an image in WPF?

I have a StackPanel containing five images and I want to put a black border around each image. The XAML I have at the moment is: <Image Name="imgPic1" Width="100" Height="75" Stretch="Fill" VerticalAlignment="Top" /> I thought I would be just able to put a one-unit margin or padding on the image and set a ...

DrawingVisual selection working - deselecting, not so much

ok, I got the several shapes in my custom FrameworkElement to allow for hit testing selection. Next comes the task of deselecting all shapes if the user clicks on a blank area. This doesn't work by default because the FrameworkElement doesn't fire a mousedown event if you click on a "blank" area. Do people solve this by putting a back...

Restrict the area that a WPF shader effect gets applied to

How can I restrict the area that a WPF shader effect gets applied to, in a similar manner to the way the obsolete BitmapEffectInput.AreaToApplyEffect used to work for BitmapEffects? Is there an equivalent property for shader effects, or do I have to add it myself within each and every shader effect that I'm writing? ...

Print/Print Preview in WPF

I have wpf based application, just wondering how to get print/print preview of wpf controls. like some window/page has panel control which has multiple controls in it like chart + graph + data grid (data grid can have hell of records so coming with scrollbar) i wanted to have print version of it but dont want to just print visual par...

Datagrid not updated when item property for filter changes

I have a simple form with datagrid and a button. Items in the datagrid are bound to ObservableCollection of customers. The customer implements INotifyPropertyChanged interface. Each customer has a deleted property (type bool). I set a filter for the customers default view to filter out deleted customers based on the deleted property. So ...

Implementing footnotes in a WPF FlowDocument

What would be the best approach to display footnotes for FlowDocument content in a FlowDocumentPageViewer? My first thought was to have the contents of the footnote follow immediately after the footnote anchor within the FlowDocument, with the footnote content formatted as a Figure with VerticalAnchor set to PageBottom. This works grea...

WPF Window Aspect Ratio

I'm wondering how to maintain the aspect ratio (i.e.: 16x9) of a window in WPF upon resize--if possible in a way that leverages MVVM. As I'm new to both MVVM and WPF, I'm not sure where to begin. Thanks. ...

WPF basic binding one object

Hi, I can bind collection to treeveiw but I don't know hot bind one simle object to wpc control. <UserControl x:Class="ReporterWpf.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> <Grid> <StackPanel> ...

WPF/MVVM: Know the SelectedCell of a DataGrid`s SelectedItem and assign a value to the SelectedCell

I bet this stuff can`t be done without much code-behind :P Can it? ...

WPF Binding ADO.Net Entity Framework to a ComboBox

Hi All I am working on a small system for a summer camp in WPF. I have a database that is linked via ADO.Net Entity Framework. It contains two tables; Campers & Bunks. The structure is as follows: Campers CustomerID, INT (Key) Name, NVARCHAR BunkID, INT Bunks BunkID, INT (Key) Name, NVARCHAR There is a foreign key relationship ...

The calling thread cannot access this object because a different thread owns it.

So I am making a simple brick breaking game in c#/wpf. I am running into an issue using timers, I feel like it is probably a simple fix but here is whats happening. Whenever t_Elapsed is fired it attempts to call Update() but when it does its like OMG Im not in the right thread so I cant do that sir. How do I invoke the method from the G...

Infragistics XamDataCards Layout WPF

I am writing a simple xaml in an attempt to give the user a choice in how they want to view information. One of the view choices I would like to use is the XamDataCard from infragistics. Here is the xaml code I have written so far: <User Control xmlns:igDP="http://infragistics.com/DataPresenter"&gt; <igDP:XamDataCards Da...

Click on label to select radiobutton in WPF with MVVM

I'm learning WPF, and am wondering if there's an idiomatic way to create a label that, when clicked, toggles a checkbox or radio button. I was somewhat surprised that the Target attribute on Label doesn't do this. I am using the MVVM pattern (with the MVVMFoundation framework.) ...

Dispatcher.Invoke blocks forever

I'm trying to invoke a dialog on the UI dispatcher : class DialogService : IDialogService { private readonly Dispatcher _dispatcher = Application.Current.Dispatcher; public bool? Show(IDialogViewModel viewModel) { if (_dispatcher.CheckAccess()) { var dialogWindow = new DialogWindow(); ...

Moving location of Expander expansion button wpf

I am new to using wpf and want to use expander to allow the user to show and hide text. I want the expander container to be the entire length of the window height 800. I want to have the expander expand to the right and have the text and expander button be in the center of the expander. I know how to make the expander expand to the ri...

Save Camera Position After Transforms

Hi :), How can I save and retrieve position of camera in WPF after Ive applied a transformtranslate3D animation to it? Thanks Q ...