wpf

Informing ViewModel of ValidatesOnExceptions input errors

In my application I have numerical (double or int) ViewModel properties that are bound to TextBoxes. The ViewModel implements IDataErrorInfo to check if the values entered fall within acceptable ranges for the 'business logic' (e.g. height can't be a negative value). I have a number of TextBoxes per page and have a button (think 'next' i...

Get reference to my WPF ListBox's ScrollViewer in C#?

I think this should be easy but I'm having a tough time with it. How can I get a reference to my ListBox's scrollviewer in C#? I've tried pretty much everything I can think of. The ListBox is in a WPF Custom Control so we use Template.FindName to get references to all our controls. My ListBox looks like this: <ListBox x:Name="PART_Sou...

Issue with dependency property

I have one dependency property which is binded to Text Block, as per dependency property if value change it will reflect the value in text block, data in property is coming from real time device, now whenever any data will come it is propagated to dependency property and will reach to text block, but now I have issue that client wants th...

WPF throws PInvokeStackImbalance when call mouse_event

Here is my code, as soon as I call mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, (long)0, (long)0); I recieve the PInvokeStackImbalance exception. Does someone knows why? [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, long dx, long dy...

WPF: How to crop/clip a Drawing or a DrawingImage?

Hello, I have a function receiving a Drawing that I need to partially expose as a DrawingImage (i.e.: its position and size will be reduced/changed to fit in a target area). How can I crop/clip a region of the original Drawing? Or maybe it is easier to do that after the transformation to DrawingImage (how clip that DrawingImage)? ...

Wpf Popup placement

Hello, Is there any chance I can place popup next to an item from ListBox? I use MVVM, list is bound to elements, and for some choosen elements I want to show popup next to the item. I have list of elements and I want to show popup when I click on specified list element, but popup should be shown next to selected list item. I tried so...

Use reCaptcha in WPF App

Hi! I'm looking for solution how to integrate WPF desktop application with reCaptcha! Anyone knows the solution? I'm working on registration module to my application, and need good and simple captcha. Thanks! ...

WPF Dynamic menu associated with the object?

Hi everyone. I'd like to be able to create dynamic menus associated with certain object. Let’s say, I will have 3 listview container with one style where I also have a Menu. I need to generate different menu items from collection of the RoutetUICommands in relation on each listview. I was trying to solve this puzzle but took me a while a...

OK To Open new Window in ViewModel?

If I want to open a new Window, without needing any immediate information, is it ok to open it this way? I know with Dialogs I should use a service, but if I don't need any information back, it is quite troublesome and messy to add a new function into the service just to open a window? // in ShellViewModel public ICommand AboutCommand ...

Selecting all ListBoxItems on double-click

I have hooked into the ListBoxItems' double-click event using the ff. code in my XAML: <Style TargetType="{x:Type ListBoxItem}"> <EventSetter Event="MouseDoubleClick" Handler="onMouseDoubleClickOnListBoxItem" /> </Style> The code for the handler is: private void onMouseDoubleClickOnListBoxItem(object sender, Mouse...

WPF tree error when navigating back to former tab

So for my application I just have an image loaded and then in a grid in a tab item. After clicking on a button I create a new tab item with associated code to load other things. However, on going back to the first tab, I am met with this error: "Must disconnect specified child from current parent Visual before attaching to new parent Vi...

SqlDependency & OnChangeEventHandler discovering what data has changed?

When using SqlDependency & OnChangeEventHandler in .Net with SQL Server, is it possible (simple?) to discover what data has changed? ...

WPF set border background in trigger

Hello! I need to create a trigger, that will change Border background property, when MouseEnter occurred. I did the follow: <Border Width="20" Height="30" Focusable="True"> <Border.Background> <LinearGradientBrush> <LinearGradientBrush.GradientStops> <GradientStop Color="Aquamarine...

move from rich clent ( WPF) to web based (Silverlight application) for multiuser application

Hello Design Gurus and architects, We have a multi user product prototype in WPF which works fine as a prototype. Now we want to build the complete product. In our product we have scenarios where 2 - 3 users might have to use same data. Say one us editing and the other user is viewing the continuos edits. And also whenever a user chan...

WPF - Drawing 3D Object

I am newbie to WPF. I have drawn simple 3D cube and rotate it with mouse But my question is, is it possible to draw wireframe object in WPF Without using any third party library(eg.Charles Petzold's libraty etc..)? ...

WPF adorner fails

Cannot add logical and visual child to Adorner class. Blockquote I have a WPF application.Infragistics grid and xamtext boxes are using. I implement the concept of history.ie when user is click on the cell or textbox, a suggestion box is being shown which contains the previous values.Sample screen shot is attaching. Blockquote ...

MVVM using DataTable?

One of our legacy application is running in VB.net(3 tier) and DataTable is used as DTO. But we want to convert the application using WPF,MVVM architecture. Can i implement MVVM using Datatable as DTO or i have to create classes to represent these datatable and implement MVVM architecture. ? ...

Books for Expression Blend 4?

Are there any good reference books for Expression Blend 4? ...

How is the DataContext typically set?

I've created a new WPF project, and threw in a DataGrid. Now I'm trying to figure out the easiest way to bind a collection of data to it. The example I downloaded seems to do it in the window c'tor: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DataContext = new ViewMode...

wpf storyboard results high cpu

Hi all I'm using few storyboards in my application in the style of few controls, the storybards use to flash the control when appears on screen, the problem is that from the first control appear the cpu usage gets to 50% I added Timeline.DesiredFrameRate="20" to the storyboards with no use is there any solution to this problem or at...