wpf

What is the best way to localize a WPF application, sans LocBAML?

There seems to be no good way to localize a WPF application. MSDN seems to think that littering my XAML with x:Uid's, generating CSV files, and then generating new assemblies (using their sample code!) is the answer. Worse, this process doesn't address how to localize images, binary blobs (say, PDF files), or strings that are embedded ...

How can I use NAnt to compile WPF controls

I have a WPF project and I'm trying to setup a NAnt build script for it. The problem is that when it tries to compile the WPF controls, the .g.cs files are not being generated as they are when building from within Visual Studio. I'm using the csc build task. From my reading it seems that when Visual Studio builds, it performs a pre-buil...

getting a DrawingContext for a wpf WriteableBitmap

Is there a way to get a DrawingContext (or something similar) for a WriteableBitmap? I.e. something to allow you to call simple DrawLine/DrawRectangle/etc kinds of methods, rather than manipulate the raw pixels directly. ...

How do I use INotifyPropertyChanged to update an array binding?

Let's say I have a class: class Foo { public string Bar { get { ... } } public string this[int index] { get { ... } } } I can bind to these two properties using "{Binding Path=Bar}" and "{Binding Path=[x]}". Fine. Now let's say I want to implement INotifyPropertyChanged: class Foo : INotifyPropertyChanged { pu...

Is it possible to set code behind a resource dictionary in WPF for event handling?

Is it possible to set code behind a resource dictionary in WPF. For example in a usercontrol for a button you declare it in XAML. The event handling code for the button click is done in the code file behind the control. If I was to create a data template with a button how can I write the event handler code for it's button click within th...

How can I access the ListViewItems of a WPF ListView?

Within an event, I'd like to put the focus on a specific TextBox within the ListViewItem's template. The XAML looks like this: <ListView x:Name="myList" ItemsSource="{Binding SomeList}"> <ListView.View> <GridView> <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate> ...

How to determine WPF SelectedItem for a window

Hi, I have a WPF app with many list based controls in a window, which all are bound to different CollectionViews. At the window level is there a way to get the current selected item for the currently in focus list based control? I know I can do this with some fairly trivial code by looking for the in focus element but does WPF support...

Apply stroke to a textblock in WPF

How do you apply stroke (outline around text) to a textblock in xaml in WPF? ...

what is the best way to display a 'loading' indicator on a WPF control

In C#.Net WPF During UserControl.Load -> What is the best way of showing a whirling circle / 'Loading' Indicator on the UserControl until it has finished gathering data and rendering it's contents? ...

WPF Datatrigger not firing when expected

I have the following XAML: <TextBlock Text="{Binding ElementName=EditListBox, Path=SelectedItems.Count}" Margin="0,0,5,0"/> <TextBlock Text="items selected"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=EditListBox, Path=...

Load a WPF BitmapImage from a System.Drawing.Bitmap

I have an instance of a System.Drawing.Bitmap and would like to make it available to my WPF app in the form of a System.Windows.Media.Imaging.BitmapImage. What would be the best approach for this? ...

Using Validation in WPF With Dependency Property and Style Triggers

I am trying to use Validation in WPF. I created a NotNullOrEmptyValidationRule as shown below: public class NotNullOrEmptyValidationRule : ValidationRule { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { if (String.IsNullOrEmpty(value as String)) return ...

What is the best online resource for learning WPF?

I'm considering WPF for a project, but I need to get up to speed with it ASAP. What was the best online resource you used to get you started with WPF? EDIT Great resources so far. Here's a run down of what we have so far: MSDN LearnWPF.com http://windowsclient.net/getstarted/ A Guided Tour of WPF Keep them coming! ...

How do you bind in xaml to a dynamic xpath?

I have a list box that displays items based on an xpath. This xpath changes depending on user selection elsewhere in the gui. The xpath always refers to the same document. At the moment i use some c# code behind to change the binding of the control to a new xpath expression. I'd like instead to bind in xaml to an xpath and then change...

WPF - find actual top and left of an image after rotating it

I am using WPF and I have an image of an 8.5" * 11" piece of paper on a Canvas. I am then rotating the image using a RotateTransform, with the axis being in the middle of the page (that is, RotateTransformOrigin="0.5,0.5"). How can I find the actual location on the canvas of the corners of the image? ...

What WPF C# Control is similar to a CWnd in C++?

What would be the best WPF control in C# (VS 2008) that you can place on a form that would allow you to do drawing similar to the "Paint" function for the CWnd class in C++? Also, that could display bitmaps, have a scroll bar, and the ability to accept user inputs (ie. MouseMove, Button Clicks, etc...). Basically all the functionality ...

WPF Validation Not Firing on First LostFocus of the TextBox

Hi, I am trying to validate the WPF form against an object. The validation fires when I type something in the textbox lose focus come back to the textbox and then erase whatever I have written. But if I just load the WPF application and tab off the textbox without writing and erasing anything from the textbox then it is not fired. He...

How do you troubleshoot WPF UI problems?

I'm working on a WPF application that sometimes exhibits odd problems and appears to hang in the UI. It is inconsistent, it happens in different pages, but it happens often enough that it is a big problem. I should mention that it is not a true hang as described below. My first thought was that the animations of some buttons was the p...

WPF Validation for the whole form

Hi, I have been seriously disappointed with WPF validation system. Anyway! How can I validate the complete form by clicking the "button"? For some reason everything in WPF is soo complicated! I can do the validation in 1 line of code in ASP.NET which requires like 10-20 lines of code in WPF!! I can do this using my own ValidationEng...

How do I stop Blend 2.5 June Preview replacing Canvas.ZIndex with Panel.ZIndex on SL1.0 XAML?

I have a Silverlight 1.0 application that I edit with Blend 2.5. Whenever I touch a UIElement in the designer that has a Canvas attribute such as Canvas.ZIndex="1", when it updates the XAML, it changes the Canvas prefix to Panel, leaving Panel.ZIndex="1", causing the page to fail to load. How do I make it stop the insanity!?! I have u...