wpf

Do WPF Routed Commands solve a problem or make it worse?

From what I understand, the goal of the Command pattern is to help separate UI interaction from application logic. With properly implemented commands, a click on a "Print" menu item might result in a chain of interaction like this: (button) ---click executes command----> (command) ---calls Print() in app logic ---> (logic) This encou...

Exporting a GUI to xml?

Is there a tool to take a GUI designed in C# or other languages that can take the screen layout and export that to an XML file such that you end up with a template of the screen in xml terms? As well as take an xml file and display the resulting screen? ...

Anti-aliasing artifacts in WPF

I have a bizarre rendering issue when I'm trying to use anti-aliased graphics in WPF. Here's a simplified version. If I use the following XAML <Window x:Class="RenderingBug.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Width="300" Heigh...

Connecting two shapes together, Silverlight 2

I'm looking to connect or glue together two shapes or objects with a Line. These shapes will be generated dynamically, meaning I'll be calling a Web service on the backend to determine how many objects/shapes need to be created. Once this is determined, I'll need to have the objects/shapes connected together. The method signature may lo...

ValidatesOnExceptions fires but it doesn't show the exception message

Hello, I have a TextBox.TextProperty bound to a ViewModel property. In the binding I have explicitly set ValidatesOnExceptions to True. In resources the TextBox has this trigger: <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(...

Memory leaks in WPF/C# - Help :)

Hi Please note this is done in WPF/c# and not in .net2.0 winforms I have a ListBox which contains objects of say Class X. Class X contains a BitmapSource object which is displayed in the listbox, so it display similar to '[Image] [Text]' This is loaded via the use of the 'CreateBitmapSourceFromHBitmap' - note also that i call DeleteHB...

How to use a different coordinate system in WPF? (scaling only)

Hi, (Let me give you some context) I am currently designing an application that is supposed to generate a printable A4 page based on some data. Naturally, the device independent pixels of WPF (96 pixels/inch) are not a very natural unit of measurement in the paper world. Something like millimetres would be more appropriate. So I got my c...

"Property 'Path' does not have a value"

I'm using the following xaml to fill the dataContext: DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" The application works fine, but Cider complains that I must set the Path property. I'm interested in the entire object, and not a specific property though. I hope there's a way to get the designer support back...

Hosting and interacting with a webpage inside a WPF App.

I need to create a Web-based Dashboard tool for a LOB application. Essentially users need to be able to log in to a web-site which will allow them to view stats for various bits of data, as well as see any notifications that pertain to them. Our primary application is built for the desktop using WPF. We also need to provide an identical ...

Treeview --> Parent node value

Hi, I am new in WPF world. I have treeView that contains Treeview Mandate --> Portfolio ---->portfolio1 Benchmarks Category ------>Name1 etc.. I would like to know how to get the parent node value in WPF ? For example, If I select the portfolio1 how to get the parent-parent value. In this case Mandat...

Winforms WPF Interop - WPF content fails to paint

I have a Winform that uses an ElementHost to display a WPF UserControl. Once every 50 times or so when the form loads the WPF content fails to paint. You can see through the Winform chrome to whatever is beneath. Resizing the window gets the WPF content to show up. Is this a known issue? Can anyone suggest a workaround? Thanks Scott ...

How do I set tab size in the WPF RichTextBox

The WPF RichTextBox can be set to accept tabs in its input. It renders the result as a 4 character indent. I'd like to change that size. How can I change the default? ...

XAML: How to mix text and element-databind variables in Content attribute?

When data binding two elements together, how can I include the binding information AND text as in the case below where I want my label to say: The font size is 8.5 <Grid> <StackPanel> <Slider Name="theSlider" Margin="5" Minimum="8" Maximum="14"></Slider> <Label Content="The font size is: {Binding ElementName=theSlid...

Looking for WPF/XAML example that gets XML from URL and displays in element

I can imagine WPF has a very easy way to grab XML from RESTful services and bind it into elements, e.g. GridView, perhaps even with 100% XAML. Does anyone have any example code showing this? ...

How can I get a vertical scrollbar in my ListBox?

In the example below I have a ListBox with dozens of font names in it. I would have thought it would automatically have a vertical scrollbar on it so that you can select ANY font, not just the first ones in teh list, but it doesn't. So I added a "ScrollViewer" and that puts a "scrollbar area" on the right but there is no scrollbar in t...

How can I set the focus of a ListBox in XAML?

I have this ListBox: <ListBox Name="lbColor"> <ListBoxItem Content="Blue"/> <ListBoxItem Content="Red"/> <ListBoxItem Content="Orange"/> </ListBox> This code pre-selects the choice alright, but doesn't set the focus, how can I do that? public Window1() { InitializeComponent(); lbColor.SelectedIndex = 1; lbCol...

Why in XAML XmlDataProvider do we have to say "x:Key" instead of "Key"?

What is the function of the namespace here? I would think in this simple example I would be able to put "Key" and "XData" instead of "x:Key" and "x:XData" but when I do it says "Key" was not found in XmlDataProvider. <Window x:Class="DataBindingWPF.XmlBinding" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x...

Benefits of developing MMC snap-ins instead of traditional GUI apps

What are the benefits of developing MMC snap-ins instead of traditional GUI apps? AFAIK the MMC snap-ins can be loaded remotely to control some server applications but I have never dived deep in this approach. What are the pros and cons of MMC snap-in approach over traditional Win Forms (or WPF) GUI applications? And btw lately PowerShe...

Are Margin and Padding implemented by ContentControl?

Hi, I am developing a custom control derived from System.Windows.Controls.ContentControl. In the controls default template (themes\generic.xaml), I use a Border element that wraps the actual content. Does my custom control already implement margin and padding (i.e., shrink the border according to the padding set on the custom control) ...

How to make a loading graphic in WPF XAML?

So I have a little WPF XAML that gets the titles of my RSS feed and puts them in a ListBox. However, it takes about 2 seconds to load. How can I have put some kind of AJAXy spinning graphic in the ListBox until the data is there? Here is the code: <Window x:Class="WpfApplication5.Window1" xmlns="http://schemas.microsoft.com/winfx...