wpf

WPF Visual Studio Templates - extend tabitem

I'm working on a wpf project in visual studio 2008. I would like to add a xmal and xaml.cs file that describe a TabItem. Templates exist for "Page", "UserControl" and others but not TabItem. How do I either make my own template or accomplish this without a template? Thanks! ...

Trying to change a CroppedBitmap's SourceRect at runtime

When I try to change a CroppedBitmap's SourceRect property at runtime, nothing happens. There's no error, and the property value doesn't actually get changed. I'm trying to do sprite animation. I have a BitmapSource that contains a spritesheet, which is a single bitmap containing a grid of different poses for the sprite. Then I have a C...

Where to put code in (primarily) windowless WPF app?

So I'm planning on writing an application that is largely a windowless application. There will be windows for user interaction, but only at the request of the user. Otherwise the application sits in the system tray and runs a timer, executing some logic every minute or so. My question is this: As far as I can tell, I would put all th...

Looking for a Example using nhibernate validation with WPF

I have a library that was written using nHibernate and I am trying to connect it to a WPF application. Looking for a way to integrate the validation without tightly coupling the code... Any suggestions ...

How can I change Item and Content Templates based on the object type?

I have a WPF TabControl that I have set the ItemTemplate as well as the ContentTemplate. This tab control displays Call Log information based on customer tech support information. Inside of this same control, I would also like to be able to show a ReturnAuthorization template. I would like to swap these out based on the object type add...

What Does this MSDN Sample Code Do? - ItemsControl.ItemTemplate

This is a XAML code sample taken from the MSDN library article for the ItemsControl.ItemTemplate property: <ListBox Width="400" Margin="10" ItemsSource="{Binding Source={StaticResource myTodoList}}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=TaskName}" /> <TextBlock Text="{Binding Path=Descripti...

A WPF App fails when coming out of hibernate mode

I have a WPF application that fails to come out of the timed sleep, followed by hibernate. The render thread seems to be failing during initialization. I tried removing hardware acceleration to check that it's not graphics card related, but that did not help. Here is an exception along with the stacktrace: ERROR An unspecified error oc...

Getting a specific control from a WPF window?

Hi, Is there a way to programatically go through a window's child elements to find one with a certain name? I'm loading xaml dynamically that creates a window and I'm looking to find a "placeholder" control inside it. Thanks! ...

WPF: template or UserControl with 2 (or more!) ContentPresenters to present content in 'slots'

Hello, I am developing LOB application, where I will need multiple dialog windows (and displaying everything in one window is not an option/makes no sense). I would like to have a user control for my window that would define some styling, etc., and would have several slots where content could be inserted - for example, a modal dialog wi...

Nesting WPF 3.5 sp1 toolkit datagrid

Hi, Has anybody been successful or can find an example of using nested grids in the WPF 3.5 SP1 toolkit Datagrid? Does anybody know if this is even supported? Thanks. ...

What are the letters in a XAML Geometry attribute called?

I am defining a XAML DrawingBrush resource and I want to draw a custom shape. I found the following GeometryDrawing example: <GeometryDrawing Geometry="M0,0.1 L0.1,0 1,0.9, 0.9,1z" Brush="Gray" /> What do the M, L, and z letters in the Geometry attribute mean? What are they called? ...

WPF Listbox and Select All

I want to create a simple ListBox and have SelectAll as a context menu item. However it seems that ListBox has some sort of inbuilt handling for SelectAll that I can't get working, but is interfering with my attempt to implement SelectAll. My entire XAML is this: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.micro...

Preventing deformation in XAML Grid's background when resizing

I am writing a brush in XAML that I can use to paint the background of a Grid to create a banner. It looks like this: I want the brush to "stretch" with the Grid when the Window resizes, but I do not want the center angles to deform. I only need to be able to draw the shapes in the background of a Grid. How can I avoid the deformat...

Is there a WmpBitmapDecoder equivelant in Silverlight?

Does anyone know how to use Windows Media Photo (.wdp) in silverlight? There is the WmpBitmapDecoder class for regular wpf applications, but I don't see anything like that when I create a silverlight application. Are there any alternative image formats that might be better or easier to use? ...

How to get a UserControl to stretch to fill the alloted space?

In a 630 x 400 Window, I'm loading there XAML elements: menu at top dynamic user control footer at the bottom The problem is that when I set the background of the UserControl, the color only goes down as far as the content. I want the background of the UserControl to cover the whole UserControl of course. I've tried: VerticalConte...

Using WPF (which requires STAThread) with an API that can't work with STAThread

I am writing a WPF application that has an optional dependency on an API that has a simple requirement; It MUST be initialized/used on a thread that does NOT have the STAThread attribute. Of course, WPF requires STA so that makes everything easy. In this case, WPF is required no matter what. This third party API is required only when th...

Is it right for a ViewModel to inject itself into its child ViewModels?

I created a MVVM test application which at runtime reads an XML file to create a menu dynamically and based on what the user selects, loads in that page's UserControl dynamically. The result is a nice MVVM pattern that allows you to have one View/ViewModel pair per page all defined in an XML file. Very nice. So now I just added the abil...

Passing parameters to a template

Hi, Say I have defined a button with rounded corners. <Style x:Key="RoundButton" TargetType="Button"> <!-- bla bla --> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border CornerRadius="0,5,5,0" /> <!-- bla bla --> </ControlTemplate> </Setter.Value> </Setter> </Style> I it pos...

Showing a dynamic size list in XAML (readonly)

Hi, I want to show a list of "properties" in my application. A property is simply a name/value pair. The number of properties is dynamic. The best way to do this? The only thing I can come up with is creating a ListView with an ItemTemplate. But then the items are selectable, and that's not what I want. If I make the list read-only, it...

Why is IsChecked property nullable boolean in WPF CheckBox?

Is there a case when IsChecked property on WPF CheckBox null ? I guess that will answer my question from title of question. ...