wpf

Displaying controls based on radio button selected

I have a group of three radio buttons. Depending on which radio button is selected, I want to disaply one of three controls - a textbox, a dropdown list, or a button. How do I display controls based on the result of a selected radio button? ...

Prevent Multi-select in WPF Tab Control?

It appears that in a WPF TabControl the user can select multiple items, either via Ctrl-Click or Shift-Click. Is there a property that controls this? Or do I have to handle the click/select event and explicitly unselect other items? ...

WPF TextBox Binding Validation Rules not Firing on LostFocus When TextBox is Empty

We all know how sucky WPF validation is out of the box. I am trying a very simple thing and for some reason it is always failing. I have a TextBox and my only requirement is to validate that the user inputs something in the TextBox. The TextBox is bound to a Customer object with FirstName and LastName properties. Here is the XAML code:...

WPF ExceptionValidationRule not showing in the Validation.Errors Collection

I am throwing an ApplicationException if the FirstName value is null or empty and I am trying to display the error message in the TextBlock which is part of the ErrorTemplate. But it always shows "Exception has been thrown at the target of invocation". public string FirstName { get { return _firstName;} ...

create printbatch to print multiply flowdocuments

How to print multiply flowdocumets in a batch? Following code should print different documents but print the same. This sample works pretty fine only if you print to the xps printer. var printDialog = new PrintDialog(); if(printDialog.ShowDialog() == true) { var xpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(printDialog...

Serial number Column in ListView

Hi, Currently I am using a sortable listview Which is bind to DataTable, I have a Serial number column which is auto incremented and displayed, Our requirement is when we sort other columns this column shall remain constant and show row numbers in series as in Excel. I am planning to have a stack panel beside listview and adding Textb...

Odd Loaded behavior in markup versus code

I'm currently very confused by the differing behavior regarding the FrameworkElement.Loaded event. I've put together a small example application that demonstrates this. Xaml: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/20...

WPF: refreshing a control with a bound property using Model View View-Model

Hey there, I am using the Model View View-Model pattern for a WPF app. I have a ViewModel (set as a pages DataContext) with two properties, one of which is an Entity with a PropertyChanged event. In the event handler i set the value of the other property (a boolean) to some value. Now the Button and TextBox properties are binding fine ...

Creating container usercontrol with design time support in WPF ?

Hi, I want to create a container usercontrol with design time support in WPF ? How can I do ? ...

How do I create a dashed border with rounded corners in WPF?

The Rectangle element has StrokeDashArray which allows it to be drawn with dashes, but it doesn't support rounded corners. The Border control supports nice thick lines with rounded corners, but will only draw solid lines. What's the best way to achieve a dashed border with rounded corners, with any control? ...

Custom scroll layout with fisheye in WPF

I know Windows Forms quite good but I'm new to WPF. I'd like to create application similar to RSS reader - in main window every note will be displayed in Post-it like frame and all notes should be chained and scrollable up and down. I also want to include kind of fisheye view - single note will be displayed full size in the centre of t...

How to implement a preview window of ListView and synchronize selections between them in WPF

I have a large list view in WPF window, and only a small part of the data can be shown at the same time. What I want to do is to create a thumbnail near it. When dragging a rectangle in the thumbnail, the list view will automatically scroll to the data surrounded by the rectangle, and vice versa. I have found this artical: http://www.t...

Does Caliburn provide a way to get a reference to the container from anywhere?

Hi! I'm currently messing around with Rob Eisenberg's Caliburn framework. When looking at the documentation that is provided on http://caliburn.codeplex.com there is an example of how to resolve a Caliburn service from the container. It's something along the lines of this: SimpleContainer container = new SimpleContainer(); CaliburnFr...

WPF calling commands via events

Hi, Is it possible to call a command via an event in WPF? I have a save button that when pressed calls a command, this is pressed when you have finished editing a textbox, it also passes an object as a command parameter <Button Content="Save" Command="{Binding DataContext.SaveQueueTimeCommand, RelativeSource={RelativeSource FindAnce...

How do I access ListViewItem?

The Items collection of a ListView contains the actual business objects. How do I obtain the corresponding ListViewItem given a business object (SelectedItem)? ...

WPF GridView: Changing the DateTime formatting for bound DataTable

We're using a WPF GridView that is dynamically bound to a DataTable (which in turn is the direct result of a DB query). This basically works fine and displays whatever the results from the DB query are in a nice table. Now the problem is that some of the results contain DateTime columns, and the date displayed is always in US format and...

using WPF navigation in standalone applications

Is using WPF navigation in standalone applications is best practice? And can it be used with WPF MVVM pattern? ...

WPF on Windows Embedded Framework question.

Hi. I am currently developing a WPF application for a Single Board AMD Geode Computer (touch screen). Windows Embedded Standard installs fine on the device and it has .Net 3.5 loaded. The application runs fine for the most part but I am getting some anomalous behavior and I am suspecting it coming from the framework, as the problems ca...

TranslateTransform in Style

I have the following code: <Window.Resources> <Style TargetType="{x:Type TextBlock}"> <Setter Property="LayoutTransform"> <Setter.Value> <TranslateTransform /> </Setter.Value> </Setter> <Style.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <EventTrigger.Actions> <BeginStoryboard> ...

My databinding with value converter does not work

I've got a simple Item-class, that looks like this: public class Item : DependencyObject { public int No { get { return (int)GetValue(NoProperty); } set { SetValue(NoProperty, value); } } public string Name { get { return (string)GetValue(NameProperty); } set { SetValue(NameProperty, value); } } public static readonly D...