xaml

How can I get a trigger to fire when the contents of a StackPanel changes?

The following code makes the contents of a StackPanel fade in when it is loaded (StackPanel.Loaded). What do I have to change to get the fade it to start when the contents of the StackPanel change, e.g. every time a message in the StackPanel changes I want it to fade in again? <Style x:Key="MessageStyle" TargetType="StackPanel"> <S...

xaml font spacing - can it be set in points?

When using fx. Word, I'm able to specify how much the font spacing should be reduced in points (ie. Condensed 3 pt). In XAML I can only use values from the FontStrech enum. Is there any other way specify the condensing in XAML, or is the only alternative to use a transformation to achieve something similar? ...

WPF - Compilation error: Tags of type 'PropertyArrayStart' are not supported in template sections

Ordinarily I wouldn't just post an error message on SO, but after a Google search only found one hit, I thought I'd at least open the floor for this error here on SO. I have a custom control called Sparkline with a dependency property called Values of type unit[]. Here's an example where I use it in a DataTemplate: <DataTemplate DataT...

Why would my XAML editor be giving me an error but the project compiles and runs fine?

I've implemented the Attached Behavior Command pattern which compiles and runs fine, but strangely my XAML editor is giving the error: The attachable property 'Behaviors' was not found in type 'CommandBehaviorCollection'. in this XAML: <c:CommandBehaviorCollection.Behaviors> <c:BehaviorBinding Event="MouseLeftButton...

Window StateChanging event in WPF

I need to handle WPF application right before it goes Minimize, not when it's already there. I found on Window object StateChanged, but it fires when Window object is already in Minimize state, then it's too late. So, I need something like "StateChanging" event to handle, while Window object is still in previous state. Is it possible t...

Using ObjectDataProvider in XAML to bind property crashes VS

Sorry for a very specific question, bot why VS2008 and VS2010 crashes with this code? I though it's a common to use ObjectDataProvider to bind property. I seen examples in many places on the web, but werether I try to use it I get exception and my VS closes. So, what is wrong with my code? Should I register a bug for VS? <Window x:Cla...

Is there any way to do a Drop Shadow effect in XAML on a TextBlock?

I have a XAML TextBlock that I would like to render as a drop shadow. That is a white layer of text on top of a black layer. I'm doing this to make the text stand. Currently I have two TextBlocks offset to the right and below by two pixels. The top layer is white and the bottom layer is black. Is there a simple way to do this in XAM...

How to make a TreeView's and ListBox's SelectedItem stay in sync?

Hi, I'm certain this has come up before, but I haven't been able to find the answer. I made a basic ViewModel that contains a list of People (an array of Person) with a property called SelectedPerson, which naturally points to the currently selected Person in the list of People. I also have a ListBox and a TreeView that are databound t...

What is the best XPS WYSIWYG Editor that will output XAML?

I am looking for a WYSIWYG for XPS that will ouput the raw XAML. My intentions is use the tool for a way to quickly generate and test the XAML (of XPS documents) with the intention of then generating the same xaml in code and programmatically generating an XPS document. The same approach that many people use for generating html. Can an...

How do I space out the child elements of a StackPanel?

Given a StackPanel: <StackPanel> <TextBox Height="30">Apple</TextBox> <TextBox Height="80">Banana</TextBox> <TextBox Height="120">Cherry</TextBox> </StackPanel> What's the best way to space out the child elements so that there are equally-sized gaps between them, even though the child elements themselves are of different sizes? ...

Using StackPanel as ContentControl (WPF)

So I have a StackPanel that I am using as a ContentControl. I have a place where I want buttons to be generated based on data that I am binding to, and that is all working good, but I want the buttons to be laid out horizontally, not vertically as is what is currently happening. Here's a screenshot: And here is the code from my Cont...

Is it possible to toggle a menu from keyboard input?

I'm building a dashboard'ish application for a special purpose hardware that has physical buttons that are bound to F1-F10, Up, Down, Backspace, Enter. The application consists of a few views (implemented using the MVVM-pattern) and most of the user interaction are done with menus that are aligned near the physical buttons. I'm trying to...

Problem binding to static property

I'm having a hard time binding a simple static string property to a text box. Here's the class with the static property: public class VersionManager { private static string filterString; public static string FilterString { get { return filterString; } set { filterString = value; } } } In my xaml, I j...

Binding Commands to Events?

Hi, What's a good method to bind Commands to Events? In my WPF app, there are events that I'd like to capture and process by my ViewModel but I'm not sure how. Things like losing focus, mouseover, mousemove, etc. Since I'm trying to adhere to the MVVM pattern, I'm wondering if there's a pure XAML solution. Thanks! ...

WPF ListBox with only Button for ItemTemplate

Hi, I am binding a list of items to a ListBox, I need some help with XAML to be able to display a button for each item. I can display a button fine, however the button takes on the length of the content text. I want my button to consume 100% of the ListBox width. I also need to stop the row highlighting for the ListBox, as the button ...

Accessing ResourceDictionary from WPF UserControl

I'm trying to access a resource dictionary in a UserControl code-behind via C# and I'm having little success. Merged Dictionary: <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Resources/BiometricDictionary.xaml" /> </Resou...

Silverlight Toggle Button Grouping

Hola, I'm developing a Silverlight app and would like to create a grouping of 5 toggle buttons (used for menu options) that animate when clicked (grow in size) and also cause any previously clicked buttons in the group to unclick and animate back to their shrunken size. I know I could use a brute force approach where the app is directl...

Boolean Animation locks property

If I have a BooleanAnimation that sets a property, that property becomes locked and can't be changed by any other means. Example: <EventTrigger SourceName="myButton" RoutedEvent="Button.Click"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <BooleanAnimationUsingKeyFrames ...

Setting a property with an EventTrigger

I want to be able to set a property with an EventTrigger, there's a number of problems with this. 1) EventTriggers only support Actions, so I must use a storyBoard to set my properties. 2) Once I use a storyboard, I have two options: Stop: Once the animation has stopped the value reverts back to before the animation started HoldEn...

WPF 3D textures with alpha channel

With WPF 3D, is it possible to have a texture with an alpha channel? I am wanting to make a 3d scene where everything is flat surfaces (like everything is paper cutouts). I thought the easiest way to achieve this would be to create a plane, divide it into quite a few triangle (like a cloth), then apply a texture with a transparent backg...