wpf

WPF and cross thread operations

Hi, i have a small WPF application where im simulating movement detected by a sensor. I fake that movement occurs after 1 minute and it stops after 2 minutes. Below is my code: public event Action OnMotionDetected; public event Action OnMotionReset; private DateTime startTime = DateTime.Now; public MotionDetect...

SVG/XAML: Defining a path which looks like an arrow

I'm trying to use SVG (really XAML) to define a path which looks like a downwards pointing arrow. | | \ | / \ | / \ / ` It is super-important that the edge of the arrow is sharp. I have tried with various combinations of M, L and z with no success. ...

WPF - Bind a List<T> as the contents of a WrapPanel

Is is possible to make the contents(children) of a WrapPanel to be bound to a dependency property? What I am thinking is having a dependency property that is of type List and then define a template for MyClass. Then have the WrapPanel display them. I know this is much easier done with a list box, but due to other constraints, I need t...

MVVM View Model DTOs

I have a WCF based application that uses the services to access repositories on the server side. I am passing DTOs from the server to the client and was wondering how best to make the DTOs part pf the view model. I have a workign example of just plain properties on the view model but was unsure how to deal with actual DTO objects and a...

How do I resolve this terminological confusion when refactoring existing code to use the MVVM pattern?

I'm struggling with a terminological conflict and can't figure out a good resolution. Maybe someone else has had this problem. I'm rebuilding an existing WinForms application to use WPF. I'll be using the MVVM pattern in my new application. My old application makes extensive use of ADO; specifically, I have Row objects that wrap Data...

Get a Bound Object from a control

I have the following xaml: <ItemsControl> <ItemsControl.ItemTemplate> <DataTemplate> <Button Content="{Binding Name}"></Button> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> In my code I have an event that gives me access to the button. How can I take the button object and get the ob...

WPF Validation Manually Adding Errors into Validation.Errors Collection

Is there any way to manually/dynamically add errors to the Validation.Errors collection? ...

UI and variable accesibility confusion

Hello everyone, I am building my own implementation of a wizard style interface and struggling to get it working correctly, along with every other style of wizard interface I expect to encounter the same problem. See image: http://img208.imageshack.us/img208/3857/wizardinwindow.jpg http://yfrog.com/5swizardinwindowj Basically I am us...

Printing of WPF Window on one page

Hi. I am able to print the current Window using the following code: PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog().GetValueOrDefault(false)) { printDialog.PrintVisual(this, this.Title); } However if the Window does not fit the page it get truncated. How do I make ...

How to change WPF Listbox/ListBoxItem DataTemplate for selected item WITHOUT affecting style & theming?

This question is very similar to Change WPF DataTemplate..., which I have read and implemented. It worked beautifully at first, but I ran into a problem with it. That problem is that, when using themes in your application such as those in the WPF Futures project (e.g. Expression Dark), the ListBoxItems all revert back to the default WPF...

Enable Maximize, Minimize and Restore Window in WPF (Manual Resize is disable)

Hi, I need to enable the following on my application (C# WPF application): 1) Have normal size of 1024*768 2) The user can maximize the application 3) The user can minimize the application 4) The user can restore the application (1024*768) 5) The user cannot manually resize the application by draging its border. There isn't any ResizeM...

How to use MultiDataTrigger to check a single condition to be true in Style.Triggers in WPF?

I have three grids in my UserControl of which one control is shown at time. In the last column I need to use a Style where I need to check the data and apply a ForeGround color. I can write style at each of the control in 3 grids using DataTriggers. But I want a concrete style in Resource which can be used anywhere. I tried MultiDataTrig...

How do I change the context menu on a WPF ESRI Symbol at run time?

An ESRI Symbol has a ControlTemplate and in the ControlTemplate I can specify a ContextMenu, and that works fine. However, I need to change the ContextMenu (add, remove items) at run time. ControlTemplate.FindName doesn't work because Symbol is not a FrameworkElement. I also know about Graphic.MouseLeftButtonDown, but I want the context ...

flowDocumentReader Selection propperty

i have written a code to select a text in flow documet reader and bring it into view docView1.Focus(); docView1.Selection.Select(textRange.Start, textRange.End); docView1.BringIntoView(textRange.Start.GetCharacterRect(LogicalDirection.Forward)); but flowdocumentreader.selection is not supported in .net framework 3....

Creating a Window.Title Attached Property

I have a Window shell that is basically: <Window> <ContentPresenter Content="{Binding}" /> </Window> Injected into the ContentPresenter at run-time are UserControls. What I want to be able to do is write: <UserControl Window.Title="The title for my window"> [...] </UserControl> So that the Window title is updated using the User...

WPF Set value by trigger when using binding

Why will not this work: <Button Width="200" Height="50"> <Button.Style> <Style TargetType="Button"> <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource Self}, Path=Height}"/> <Setter Property="Background" Value="Blue"/> <Style.Triggers> <Trigger Property="Button.Is...

Firing 1 usercontrol used for 3 different window at page load with different data

Hi Every one, Iam Divya working as developer. I had some issues. Hope there are many knowledged persons to solve my problem. We are following Model -View -View Model Pattern for WPF Window Project. I have an Window (contains only an XamData Grid) Which is complete User control. This User Control is used in 3 windows(Male Window, ...

Problem with ScatterView - Components behind disabled

Hi everybody. I'm working currently on a simple project which consist of a ScatterView with a lot of items and then a Navigation (Implemented as many buttons). The problem is that i will like to have the ScatterView on top of everything, so that users can interact on the whole window as they want. I tried different things: If I put ...

How to add Type Parameters to XAML

I have the following class: public class DefaultDropTargetAdvisor : IDropTargetAdvisor { I decided to make it have a generic parameter: public class DefaultDropTargetAdvisor<TDragType> : IDropTargetAdvisor where TDragType : class { This was my XAML before the change: <local:DefaultDropTargetAdvisor x:Key="targetAdvisor1"/>...

Get the UI object from a data object

I have a class (MockWI) that I have defined the following DataTemplate in app.xml <DataTemplate DataType="{x:Type local:MockWI}"> <Button Content="{Binding Name}"/> </DataTemplate> In my code I need to find the UI object that an instance of MockWI has. Right now I do this: Button elt = new Button { Content = myMockWI}; But tha...