wpf

Help with the WPF TextCompositionManager events

The docs on this are pretty shoddy. There are a number of events you can hook into to monitor and take control of text input that are accessed via the TextCompositionManager. If you're wanting to do something like snag card swipe data, this is where you'd do it. There are three events that concern text input: TextInput, TextStart, an...

WPF - Binding and RenderTransform

Hello, I would like to bind a scaleTransform to a converter passing the ActualWidth or ActualHeight. Here what I want to do : <Canvas x:Name="Canevas"> <Canvas.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UIElemen...

Is there a more performant alternative to ImageList.Images.Add?

I have a winforms ImageList which contains 200 256x256 images. When I add the images, 1 by one, half of the programs time spent on the Add method according to ANTS .NET profiler. So the program takes 10 secs to launch and 5 is spent there. That is very slow in my opinion. I implemented the same thing using ImageList.Images.AddRange. T...

How can I prevent input controls from stealing the space character from the TextCompositionManager?

Related (but not a dupe!) to this question: http://stackoverflow.com/questions/1053210/help-with-the-wpf-textcompositionmanager-events When using the TextCompositionManager I'm having an issue where, if an input control such as the TextBox has focus, the TextBox will "steal" the space character before I can get a chance to act on it. ...

Finding the position of the caret in a TextBox

I need to know the position of the caret in a TextBox so I can pop up a context menu near it. How do I find its placement (not character index)? ...

How to remove a wpf element on a canvas by it's tag name?

How can you remove a wpf element by some kind of name? So sth like : // Bar is some kind of usercontrol Bar b = new Bar(); b.Tag = "someId"; theCanvas.Children.Add(b); // Later to be removed without having the reference theCanvas.Children.RemoveElementWithTag("someId") Except ofcourse, RemoveElementWithTag isn't an existing method....

VB.Net WPF Key Value Pair Dictionary in Application Settings

I am looking for a way to store a key-value pair in the application settings. From what I have found, key-value pair dictionaries are not serializable, and therefore cannot be stored in the application settings. Currently I have tried all sorts of dictionaries and collections and all of them work, until I restart the application, then a...

F#: is there no UI (like WPF) for it?

i recently saw some videos on F#. it seems it used mainly for Service or Classes only? i see no "F# WPF" app in VS2010 Beta? ...

How to make my WPF UserControl work with CompositeCollection

I have a wpf user control which exposes an IEnumerable ItemsSource DependencyProperty. I bind this property to a ListBox control in my UserControl. I would like to know how I can make my user control work when a CompositeCollection is given. Currently I'm utilising my control like this: <my:uc> <my:uc.ItemsSource> <CompositeColle...

MVVM model design

In MVVM pattern I don't want to think about the view while creating the model. So I use public properties with data stored in ILists and so on. But then my viewmodel isn't informed of changes done to these lists on model side. Should I use ObservableCollections in my model instead? But this seems strange to me. ...

How can I hide the space to the left of menu items in XAML menus?

Is there a way that I can suppress the space to the left of a MenuItem's text? Something like LeftAreaVisible="Collapsed" (pseudo-code) below: <Menu DockPanel.Dock="Top"> <MenuItem LeftAreaVisible="Collapsed" Header="MVVM" ItemsSource="{Binding MvvmMenuPageItemViewModels}" ItemTemplate="{StaticResou...

Trigger Animations

Hi, I have a usercontrol that when I double click on it, I want it to zoom in, if it's not already. If it is, then the double click will zoom out on it. I can get it to work with code behind, but I can't get it to work in xaml. Here is the code behind that handle's the double click event. void MyObjectMouseDoubleClick(object sender, M...

Deactivate FocusVisualStyle globally

I want to globally deactivate the focus rectangles in my WPF application. For single controls that can be done via <Style TargetType="Button"> <Setter Property="FocusVisualStyle" Value="{x:Null}" /> </Style> but how to apply it to all controls in my application. When applying to FrameworkElement nothing happens. What I need would ...

Is there a CLR profiler that works with .NET 3.5 SP1 and WPF?

In all of my searching, I've only been able to find this one link that suggests the old CLR Profiler for .NET 2.0 should work with .NET 3.0 or 3.5 applications. When I try and profile my .NET 3.5 SP1 WPF application with the CLR Profiler for .NET 2.0 it starts up my application just fine, but it throws up a dialog that says "Waiting for...

Activate Trigger from Foreign Control

WPF newbie here so excuse the simple question. How do I cause a trigger to fire on a UserControl from a control outside of that UserControl? Here's what I want to do... I have a UserControl with a trigger set to display a background color change on itself when IsMouseOver is True. If I mouse over the UserControl, the trigger fires as...

Creating a CroppedBitmap at runtime - won't load from resource

I'm trying to write code that will load an image from a resource, and then crop it. This code works when I do all, or part, of it in XAML. I want to switch from all-XAML to all-code, so I can reuse this more than one place, with different Uris. But when I try to do the same thing in code, I get a DirectoryNotFoundException, because sudd...

MVVM Design for Multi Document app?

I have an application which has a similar interface to Visual Studio, in that there's a list of documents that can be opened, edited an saved. Each document can be of different types and has different editors. I also have a general Save MenuItem. What I want to do is have the Save command only save the active document. Is there a stand...

MVVM opening new Workspace from Other Workspace (instead of Main ControlPanel)

Hi, I am learning MVVM using sample created by Josh Smith at http://msdn.microsoft.com/en-us/magazine/dd419663.aspx I wanted to add a functionality of update in the existing code, Like when user sees data on the Grid of 'All Customers' user can edit particular record by double clicking it, double click will open up new tab (same view/...

Naming conventions for MVVM?

I'm struggling a little over naming classes for my MVVM application. I have a TrainingCourse, which is called a TrainingCourseViewModel, but I can have many of these, so I have created a TrainingCourseViewManager to hold the list of courses and allow them to be added/removed. I also have an EmployeeViewController which has a reference t...

WPF owner window on top of child window

Is it possible for Owner window in WPF be on top of Child window when you click on it while Owner window is below Child window? here is example how I call child window: Window2 window = new Window2(); window.Owner = this; window.Show(); Parent/Owner window will always be under child window. ...