wpf

wpf PathFigure to draw/show/display text

How can we draw text using PathFigure? ...

WPF c# Subscribe/Publish events mechanism using reflection - right or wrong?

I want to achieve a simple Subscribe/Publish mechanism within a WPF application so i can subscribe to events from different places in the application specifying the event type and handler method, and then when publishing the event, my mechanism will call all the subscribed methods on the subscribers. I cannot use the RoutedEvent as I wan...

Attach command with parameter to KeyUp event

Hi, I am currently transforming a medium size WPF project to MVVM and I ran into a problem that I wasn't able to solve, yet. Maybe you could help me out? The target framework is .NET 3.5.1. I have a list view that gets its items from the underlying view model. That view model is exposing a command to remove the selected items from the...

Accessing colors in a resource dictionary from a value converter.

Hi, I defined several colors in a ResourceDictionary. e.g.: <ResourceDictionary ...> <Color x:Key=Gray1>#FFF7F1F3</Color> <Color x:Key=Gray2>#FFDDD8DA</Color> So I can reuse them everywhere in application. Now I wrote a value converter to convert the items inner state to the related color. How can I access the defined colors i...

Func property on user control

I have a user control which I would like to add a dependency property of type Func so I can assign it a method handler in XAML. However, this will cause an XAMLParseException: 'Func`2' type does not have a public TypeConverter class. What am I doing wrong? Do I need to implement a TypeConverter for Func or is there a better way? The Fun...

WPF Rendering issues when used on Medium Colour monitor(16bit colour)

Hi there, I'am testing a WPF application, and I have noticed a strange issue. I am using duel monitors one is using the 32bit High colour, the other is using 16bit Medium colour. This is so that I can match the resolutions nicely. If I open the application on my high colour screen I have no problems, but if I open it on my medium colo...

How to render a usercontrol loaded via LoadComponent to a bitmap/image in WPF?

I'm trying something along these lines. //Somewhere in my app System.Uri resourceLocater = new System.Uri("/MyApp;component/Users.xaml", System.UriKind.Relative); var obj = Application.LoadComponent(resourceLocater); //Invoke the renderxaml element var image=RenderXamlElement(obj as UserControl); //Then I may save this image to a fil...

Showing custom tooltip?/Popup when hovering over an object in Silverlight

How can I go about getting similar popup/hover/tooltip (see image below) when I hover or click on an object in my Silverlight app? Update: (added bounty) I am looking for a control which can drop a shadow and show the arrow. I want like 3-4 lines of data which I can pass in as the control's properties. ...

C# WPF Files Creation

How can I create access 2000-2003 file using C# WPF and add tables in, data in and perform queries on it? ...

WPF/WinForms/GDI interop: converting a WriteableBitmap to a System.Drawing.Image?

How can I convert a WPF WriteableBitmap object to a System.Drawing.Image? My WPF client app sends bitmap data to a web service, and the web service needs to construct a System.Drawing.Image on that end. I know I can get the data of a WriteableBitmap, send the info over to the web service: // WPF side: WriteableBitmap bitmap = ...; in...

WPF refresh TreeView when it loses the focus

Because of the changes I have done to my post I have thinked to open another thread. In the new thread I have posted my (provvisory) solution. You can find it here Hi! I have a problem with my TreeView in a WPF application (Framework 3.5 SP1). It's a TreeVIew with 2 Levels of Data. I expand / collapse the items of the first level in a p...

how to get the available (visible) width of the TreeViewItem inside a TreeView

Hi, I have TreeViewItems where the HierarchicalDataTemplate consists of a Grid with 3 columns with the following definitions: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="1*" /> <ColumnDefinition Width="Auto" /> ... I want to set the width of the grid so that it would ta...

saving the inkcanvas

Hi, In my application the user can create multiple objects (so called drawings) each of which has a SurfaceInkCanvas, very similar with the Photopad (the Photo Paint app)in the SDKSamples(provided by MS Surface SP1 SDK). What would be the best way to save the content of the inkCanvas(the drawing object) given the fact that there may b...

How can I update my Visual Studio solution so that it uses WPF 4.0?

Hello everyone, I recently converted my solution from Visual Studio 2008 to 2010, hoping I would be able to use WPF 4.0's SelectionBrush property. I try to access this property in the XAML for my project as follows: <TextBox SelectionBrush="Aqua"/> Disappointingly, It underlines my code and says: The property 'SelectionBrush' was no...

surface drop image scatterview to librarystack, trigger event

Hi, I am new in this field and am trying to do a drag and drop from scatterview to librarystack, and when drop is executed, an event should be triggered ( after an image is dropped in the librarystack, a message box will be shown). However, I can not find the way to do it.. Below is the code snippets <Grid> <!-- Drop 1.jpg to libraryst...

In wpf, is there a way to execute code before the control is unloaded...? like maybe an unloading event?

Hi, I need to execute code before a wpf user control is unloaded and cancel the unloading if certain conditions are met and keep the control open in its current state in the ui... Is there any way I can accomplish this? I couldnt see anything like unloading event? Thanks, ...

How to use DrawThemeTextEx in WPF

Hi, I'm working on an application that displays text on Aero Glass. To make it readable I used a OuterGlowBitmapEffect, but, as also described here this is no longer possible in .NET 4 and the DropShadowEffect won't work for Glass either. While searching for a solution I came across the native DrawThemeTextEx in DWMApi, but all examples...

Master-Detail Split Between Two View Models: Where to put cancel command logic?

Hello, Master section of window contains a DataGrid. Details section displays a form allowing editing of record currently selected in master's DataGrid. Grid's SelectedItem is bound to the master vm. When that property changes, the master vm creates a new EditViewModel, exposing it via a property. The details section of the view uses th...

How to use WPF from a Visual Studio 2010 macro?

Is it possible to call WPF from a VS2010 macro? If I try to add a reference, the PresentationFramework etc. are not there. Is there any way around this aside from writing an addin? ...

Why are all of my line-breaks changing from "/r/n" to "/n/" and how can I stop with from happening?

I am saving my files as xml documents, using XDocument.Save(path), and after saving and loading a document all of the line breaks have changed from "/r/n" to "/n/". Why is this happening and how can I fix it? ...