wpf

How can I make a Button appear in the Header of a WPF TabItem using bindings?

I am creating a UI in which a TabControl has a series of standard TabItems with ordinary WPF controls as their content. The headers just display ordinary strings as usual. However, I want the header of the last item to contain a Button instead of an ordinary string. Let me stress that I already know how to do this without bindings. I wa...

Why are there self-duplicating curly brackets in persisted WPF RichTextBox?

Our tester threw curly brackets at our persisting WPF RichTextBoxes. On save and reopen, there are magically more curly brackets. I've condensed the issue / code down. <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title...

How do I do Print Preview when using a DocumentPaginator to print?

I'm using a class I've derived from DocumentPaginator (see below) to print simple (text only) reports from a WPF application. I've got it so that everything prints correctly, But how do I get it to do a print preview before printing? I have a feeling I need to use a DocumentViewer but I can't figure out how. Here's my Paginator Class: ...

Loading dlls from gac is blocking app

The last few months my application grew bigger and bigger. It's runnable as Wpf .EXE and XBAP at the moment, both sharing the same code. At a few points in the application, the application locks. After invertigating I found out that the application is loading dlls from the GAC at these moments. What happens is that the application star...

What type of object should I be binding to my WPF form in an n-tier app?

I am currently working on a small N-Tier application in C# which uses Linq-to-Entities (SQL Express 2005 for the DB) and WPF and I am wondering what type of data collection my business logic layer should be supplying to the user interface. Are there downsides (performance, validation etc) to binding form objects like datagridviews to an...

Using BasedOn Style Property on DynamicResources

hi there, i wonder if there is a way to use the basedOn property of wpf styles with dynamicresources. e.g. <Style BasedOn="{DynamicResource somestyle}"> <Setter Property="SomeProp" Value="SomeValue"/> </Style> this e.g. throws an error indicating that the usage of dynamicresources in combination with BasedOn styles is not possible...

About 3D effect in WPF

I'm developing WPF SW, and I see the 3D effect is very slow if we did it in XAML file, I want to know if there is a book which introduce how to do 3D effect in WPF? Thanks in advace. ...

Modifying an ObservableCollection<T> declared as a resource at runtime

I have a bunch of ObservableCollections which are populated from a database. There's agood chance that during the application lifetime these collections will grow and i need them to be updated every 30 seconds or so. I declare the collections as resources in merged dictionaries in App.xaml. I can fetch these collections fine by using ...

Listbox Scrollbar customization in WPF

I'm making an application for being used in a touch screen. One of the forms shows a listbox with scrollbar activated that is a little bit tricky to use by touching the screen with fingers. I have tried to make an style that makes bigger buttons inside the scrollbar but I can't apply it to a listbox. Is it possible to make a style for ...

Draw custom element between listbox items

I want to draw custom elements (like an empty square> between the items of a listbox, to indicate that users can insert/drop items from another listbox between other items. How can I do this? I have some rather hacky solution for this, but I hope there is an easier way to do this. One of the ideas is to use different DataTemplates for ...

Sorting WPF ListView with System.Linq.IGrouping<string,Class T>

Hi there, actually Im not getting problems with sorting a normal ListView.ItemsSource, my issue actually comes when I have a IGrouping List as ItemSource or SelectedItems, Im using the following snippet : private void Sort(string sortBy, ListSortDirection direction) { lastDirection = direction; ICollectionView da...

MasterWindow in WPF

Hello, I am used to developing ASP.net web apps and now doing some exploring in WPF windows client apps. I had been extensively using MasterPage and Themes to make my application have a uniform look. How can I accomplish the same in WPF? What are the best practices for this? For starters I am working on a very simple application that...

WPF: Sizing images inside grid and listbox

I have a ListBox with horizontal scrolling, and each item consists of a two row grid. The first row contains an image, and the second row a border used to render a reflection of the first. (Yeah, yeah. I know. Yet another coverflow attempt...) I need some help with the sizing of the images. If I don't specify any size, it will render th...

WPF ControlTemplate How to

I am very new to WPF, about 4 hours new. I am coming from ASP.net and Masterpages. I was looking at examples of Control Template that can used to template a window so all windows look the same. Other post Can some direct me to an example of how it is accomplished or sample code from start to finish? Second part: Is the ControlTemplat...

WPF: Best (reliable) way to translate (move) a Canvas AND monitor Every step

I have tried translating (moving) a canvas but I'm having trouble with the timers. I tried 2 different methods: First method was with the BeginAnimation function, and the second with DispatcherTimer ticks, but they're both very unreliable. I need to monitor every step of the translation. With the first method I tried (BeginAnimation)...

What is WPF and how does it comapre to WinForms?

I've been looking at WPF, but I've never really worked in it (except for 15 minutes, which prompted this question). I looked at this post but its really about the "Flash" of a WPF. So what is the difference between a Windows Forms application and a WPF application? ...

How do I set the name of the print job when using DocumentViewer control?

I've using the WPF DocumentViewer control to display an XPS Document like so: viewer.Document = xpsDocument.GetFixedDocumentSequence(); When the print button inside the document viewer is clicked everything prints okay, however the name of the print job is System.Windows.Documents.FixedDocumentSequence, which is less than ideal. How ...

WPF - UserControl sizing on Custom Canvas

I have a custom canvas that I can drop controls on, move, and resize. I need to be able to at least start with a pre-determined size but then allow re-sizing. My problem is that I have a user control that doesn't appear to resize. I set Height and Width on the user control (works on drop). then as the control is resized on the canvas ...

How can I get WPF binding to occur on controls which have not yet been shown?

I have a custom text box control which raises a routed event when its TEXT property changes. This text property is data bound to a property on our view-model object. When I place this control on a TabControl page or Expander control, it appears as if data binding only occurs when the control becomes visible for the first time, therefore...

How to set the final value of an Animation to the property when the Animation finishes or is canceled?

I try to animate a DependencyProperty from a value to a target value (in code) and when the animation finishes (or is canceled) set the final value to the property. The final value would be either the To value if the animation finishes or the current computed value (by the animation) when the animation is canceled. By default the Animat...