wpf

How can I get the active screen dimensions?

What I am looking for is the equivalent of System.Windows.SystemParameters.WorkArea for the monitor that the window is currently on. Clairification: The window in question is WPF, not WinForms. ...

When can I dispose an IDisposable WPF control e.g. WindowsFormsHost?

The WPF control WindowsFormsHost inherits from IDisposable. If I have a complex WPF visual tree containing some of the above controls what event or method can I use to call IDispose during shutdown? ...

How can I best handle WPF radio buttons?

I've got some RadioButtons in my XAML... <StackPanel> <RadioButton Name="RadioButton1" GroupName="Buttons" Click="ButtonsChecked" IsChecked="True">One</RadioButton> <RadioButton Name="RadioButton2" GroupName="Buttons" Click="ButtonsChecked">Two</RadioButton> <RadioButton Name="RadioButton3" GroupName="Buttons" Click="Buttons...

Equivalent WPF binding syntax

I need some help with WPF binding syntax: public class ApplicationPresenter { public ObservableCollection<Quotes> PriceList {get;} } public class WebSitePricesView { private IApplicationPresenter presenter { get { return (ApplicationPresenter)DataContext; } } // public ObservableCollection<Quotes> PriceList ...

Parsing a local XML Document in WPF (works in debug, fails once published).

I am building a WPF application. Inside that application I am using the XmlReader class to parse several local XML files. The code I have written works perfectly during debugging, but fails once I publish the application and install it. I have the XML documents as CONTENT in build action, and I have them set to COPY ALWAYS.I can confirm...

WPF CommandParameter Binding Problem

I'm having some trouble understanding how command parameter binding works. When I create an instance of the widget class before the call to InitializeComponent it seems to work fine. Modifications to the parameter(Widget) in the ExecuteCommand function will be "applied" to _widget. This is the behavior I expected. If the instance o...

Bring a window to the front in WPF

How can I bring my WPF application to the front of the desktop? So far I've tried: SwitchToThisWindow(new WindowInteropHelper(Application.Current.MainWindow).Handle, true); SetWindowPos(new WindowInteropHelper(Application.Current.MainWindow).Handle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); SetForegroundWindow(new WindowInter...

Accessing TemplatePart without changing ControlTemplate?

hi there, i wonder if there is a way to access a control's templatepart from within c# for modifying the part (e.g. hiding, etc..). is it possible to get a reference to the part with pure c#? i don't want to touch the controls template. thanks j. ...

WPF - Binding IsMouseOver to Visibility

I have a window which overrides a RadioButton's ControlTemplate to show a custom control inside of it. Inside the custom control, I have a button's visibility tied to IsMouseOver, which works correctly in showing the button only when the mouse is hovering over the control. However, when I click on the RadioButton, the Button disappears. ...

Determine number of screens and screen relative location without WinForms

I want to save and restore the window position of my WPF application. I want to make the code robust to use with multiple monitors who's number and relative location can change (I want to avoid opening my application off-screen when the monitor configuration has changed inbetween invocations). I know of the Screen class in System.Window...

WPF HiercharchicalDataTemplate.DataType: How to react on interfaces?

Problem I've got a collection of IThings and I'd like to create a HierarchicalDataTemplate for a TreeView. The straightforward DataType={x:Type local:IThing} of course doesn't work, probably because the WPF creators didn't want to handle the possible ambiguities. Since this should handle IThings from different sources at the same time,...

WPF ListBox bind to index of the item

It's easy to bind something to the SelectedIndex of the ListBox, but I want every item in the ListBox be able to bind to it's index in the list. Might sound weird, so here's what I'm trying to do: <DataTemplate x:Key="ScenarioItemTemplate"> <Border Margin="8,2,8,2" Background="#FF3C3B3B" BorderBr...

Ambient Occlusion Shader Effect in WPF?

Hello All, I guess this is a multi-part question. I can import a 3D model into my WPF application but how do I apply an ambient occlusion shader effect to it? I know with .NET 3.5 SP1 you can do custom effects but that's limited to pixel shaders and doesn't include vertex shaders. I think i can do this with an XNA application but Im n...

Should I Keep Business Objects Separate from the UI in WPF?

WPF's view model oriented way of doing things makes it very tempting to just use business objects in the UI. Have you seen any issues with this? Why or why wouldn't you do this? ...

How do I copy a WPF resource in xaml?

I want to assign a resource I already have a second name, similar to using the BasedOn property of Styles. Specifically I have a brush that I use for a group of elements called ForegroundColor and I would like to use it in a control template (a ComboBox) calling it MouseOverBackgroundBrush. I would like to do something like this: <Resou...

Any free WPF themes?

Hi, I'm not a designer, so I'm looking for some free WPF themes. Any suggestions? ...

Characteristics of a good UI designer

What are the characteristics of a good UI designer? How much does one have to have graphical design abilities these days as opposed to interaction design abilities. I see this of growing importance with the advent of WPF and Silverlight. I personally consider myself good at interaction design, but would like to strengthen my skills in t...

WPF: Bind an element to two sources

I currently have two text boxes in which accept any number. I have text block that takes the two numbers entered and calculates the average. I was wondering if there was a way I could bind this text block to both text boxes and utilize a custom converter to calculate the average? I current am catching the text changed events on both text...

Detecting changes to the source data using the XmlDataProvider and a bound TextBox

I have a TreeView bound to an XmlDataProvider. The name of a node is reflected in the tree and the data of the node is in a TextBox. When you click on a tree item, it loads the data in the TextBox. What is the best way to determine when a user has changed the source data referenced by the XmlDataProvider. I would like to put an aster...

Weird behaviour when running ClickOnce deployed version of WPF application

Hi, We have a Navigation Based WPF application. It works fine when running directly from Visual Studio, or even if we copy the files to another directory or another computer and run it there. We deploy the application over the internet using ClickOnce and most of the time this does not cause any problems. Every now and then however, i...