wpf

How to Set the type of the Identity & Principle objects in WPF & WinForms

In ASP.Net when you're using Master Pages, you can provide the page a "MasterPage Type" pre-processor command along these lines: <%@ MasterType VirtualPath="~/MasterPage.master" %> This is used to provide you access to methods and properties that are defined in the Master page's codebehind. By default, when you use: Page.MasterPage ...

How do I determine at runtime whether the style applied to an object is the default style?

I want to be able to apply a style at runtime to an object ONLY if the current style is the default style. I don't want to override any user defined styles. Anyone know how to do this? ...

Style a WPF's ListView Header's hover color

Anyone know how to style the header hover color of a WPF ListView? Thanks! ...

How do I remove minimize and maximize from a resizable window in WPF?

WPF doesn't provide the ability to have a window that allows resize but doesn't have maximize or minimize buttons. I'd like to able to make such a window so I can have resizable dialog boxes. I'm aware the solution will mean using pinvoke but I'm not sure what to call and how. A search of pinvoke.net didn't turn up any thing that jumped...

What is the best approach for applying styles to massive amounts of items?

In my LOB apps I usually wind up with containers that contain a bunch of different textblocks and textboxes for users to enter data. Normally I need to apply a certain margin or vertical/horizontal alignment to each control. Let's say I have Grid on my form that looks like this (a lot of markup was eliminated for brevity): <Grid> <G...

embed google map in wpf control

Hi, I am trying to create a wpf control that will display a map image using google maps. I want to be able to centre the map on a longitude and latitude specified by the application. Ideally, the control will then allow the user to move a map marker and store the latitude/longitude of the marker in the application. The only way I can t...

Application.Exit didn't kill a message pump?

I have thread exception handler which saves the exception stack trace and should close the application. I call Applicatoin.Exit, but that only closes the window, living the app running windowless. I know, that this usually happens because some background threads are still running. I attached windbg to the windowless process and there s...

How to delegate a method call to another thread ?

I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and Views that belong together are created on a separate thread and get a separate Dispatcher. Now someone calls from another thread a method on the Presenter. I am intercepting the call, and now begins the problem: if the call co...

How do I apply a dynamic style in code at runtime?

I need to apply a style in code ike this: TextBlock.Style = TryFindResource("MyStyle") as Style; that will be updated dynamically when the resource dictionary is changed (i.e. skin is replaced at runtime). In other words I need the equivalent to using a dynamic resource like this: <TextBlock Style="{DynamicResource MyStyle}" /> ...

ContextMenu on WindowsFormsHost control

So, I have a WindowsFormsHost control in my WPF app (hosting a Dundas Chart) and I want to put a ContextMenu on it. I can successfully attach a ContextMenu to any normal WPF control, but it's not working for the WindowsFormsHost. I suspect this is becuase it's "special" in some way and the appropriate mouse messages aren't reaching the ...

Using IDataErrorInfo in M-V-VM

If my domain objects implement IDataErrorInfo, and I am using M-V-VM, how do I propagate errors through the ViewModel into the View? If i was binding directly to the model, I would set the "ValidateOnExceptons" and "ValidateOnErrors" properties to true on my binding. But my ViewModel doesn't implement IDataErrorInfo. Only my model. What ...

Is there a way to force a WrapPanel to insert a "newline" in WPF?

If I am inserting elements into a wrap panel and there is still space in the panel before it overflows on the next line, can I specifically make it wrap over so that the subsequent elements are on the next line? I am looking for something like this: <WrapPanel> <Element/> <Element/> <NewLine???/> <Element/> <Element/> <El...

Aligning content in a WPF Viewbox

I have a Viewbox that is using Stretch=Uniform in order to not distort the content. However... when the frame window is wider or taller than the content, the Viewbox content is always centered. I cannot seem to find any content alignment options on the Viewbox. Is there a way to do this? ...

Event on validation - WPF

I'm looking at developing a simple validation framework for WPF (the IDataErrorInfo method doesn't provide enough info for my needs), and am wondering if there is a way to be notified when a Property is going to validate? Please note that I need to know any time it is going to attempt validation rather than only when there is an error (s...

wpf listbox change individual items to bold

I want some of the items to be bold depending on a property of an object i'm putting into the listbox. I think you can do it with changing templates but can't seem to find an example. Thanks! ...

How do I get the instance of a templated item from a databound ItemsControl? (WPF)

I have an <ItemsControl> with a custom <DataTemplate> (and also a custom <ItemsPanelTemplate> that is just a WrapPanel), bound via ItemsSource to a simple observable collection of strings. The DataTemplate consists simply of an instance of a custom UserControl whose properties are bound to the string via {Binding}. The problem is since...

WPF - Animations in a user control, learning, trying to understand, but feeling n00bish.

OK I'm redoing this since I messed it up. :) here's the xaml. <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ucWaitIndicator.Window1" x:Name="Window" Title="Window1" Width="640" Height="480"> <Window.Resources> <St...

C# How to set a flexible base for altering controls from assembly later?

Hi @ all :) I'm still new with C#, and I'm working on a project where we also use WPF, and the WPF DataGrid Toolkit (See at CodePlex), which hasn't yet been released into the framework. Due to the nature of the project, it's 100% sure we will be altering some controls of the assembly later. My co-workers have decided to redefine every ...

Richtextbox wpf binding

To do DataBinding of the Document in a WPF RichtextBox, I saw 2 Solutions so far, which are to derive from the RichtextBox and add a DependencyProperty, and also the solution with a "proxy". Neither the first or the second are satisfactory. Does somebody know another solution, or instead, a commercial RTF control which is capable of Data...

WPF Ellipse Black Background

How can I remove the black color in the corners of the ellipse? Thanks, ...