xaml

WPF/XAML/C# Setting a Boolean

If i have a boolean in one of my ViewModel Class lets say public bool test = true; (This is in C#) Is there ANYWAY possible in XAML/Expression Blend that i can take this value and change it to false BUT USING PURELY XAML, no code behind or anything. I'm trying to do this for a mouse over event, but can't seem to be working. If a mou...

WPF: ComboBox cannot be opened after appying style

I used XamlPadX to copy the defaultstyle of the ComboBox and pasted it into my app ressources. Now after that I cannot open the combobox anymore. If I click on the dropdown button, nothing happens. Another thing is bugging me. Altough the app compiles and runs, the designer shows me an error on the following line: <ComboBox Name="modi...

How can I make a WPF element resize after rotation, rather than before?

I have a simple, horizontal <Line> element. This line has a RotateTransform applied to it, which slants the line at whatever angle I choose. The problem is that the rendered length of the line is calculated before the transformation is applied. The result is that the line no longer fits its parent element after it is rotated. My curre...

Adding a style to HierarchicalDataTemplate generated MenuItems

I'm adding my hierarchical data to a Menu-Control using the HierarchicalDataTemplate. <HierarchicalDataTemplate DataType="{x:Type local:MyType}" ItemsSource="{Binding Path=SubItems}"> <StackPanel> <TextBlock Text="{Binding Name}"/> </StackPanel> </HierarchicalDataTemplate> My Menu is created like this <Menu> <Menu...

What is the best way for non-developers to create XAML Grids?

We need to have non-developers create dozens of input forms with XAML. The best solution I found was the free XAML Power Toys since you can create and edit grids visually, also create from classes. I took a look at Blend 3 quickly, dragged a Grid into my Window but found no options to actually create, say, a 4 x 10 grid with labels. I ...

Microsoft Expression Blend (silverlight): repeating header?

Hi I'm using the new microsoft expression. I'm trying to create a repeating header much like this one at http://csstreacle.artygirl.co.uk/. Is there a way I can do this in Expression blend. How do I organize the containers? And how do I set it to repeat in code or manually? Any ideas would be really helpful :) I have a rectangle with ...

Creating a WPF button with a dynamic name in XAML

I have a bound ListBox in WPF where each item has an up / down button to move the item up or down in the list box. However I need to know which button fired the event so I want to set the name of the button to "UpButton" + listBoxItem.Text type of thing. Here's a simplified version of the XAML <ListBox> <ListBox.ItemTemplate> ...

WPF - Managing styles and avoiding messy resource dictionaries

Hi, I've spent hours working on an application design in WPF and created a whole bunch of different styles along the way. But I noticed that I actually had just edited the styles in the SimpleStyles.xaml file and not a custom dictionary. So, I started right clicking all controls I could find and selected "edit a copy" and created a copy...

WPF .g.cs files

My .g.cs file for a window i made is not generating.. Is there any way where i can make it generate manually? ...

WPF: TextBox dataBinding not happening if you activate button with mnemonic

Suppose you had a text box bound to a property of a data item, and a button. If you enter text in the text box, then click on the button with the mouse, the following events happen in this order: The text is written from the control to the bound item The button click event is fired However, if you activate the button with a mnemonic ...

WPF: assign child element to property in XAML

Hi I want to do the following in xaml: I have a property FocusTarget in my control class which I want to assign an UIElement from the current class. Is this possible in XAML? <my:BaseControl x:Class="SectionControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/200...

WPF and external CSS file

Is it possible to store style definitions in one file (XXXXX.css) and then to use this file in XAML files? ...

How to make WPF pop-up windows not be hidden behind main application?

In a WPF application, I have buttons which pop up instances of windows. I click the first button and the first window pops up correctly in front of the main application. I click the second button and the second window pops up correct in front of the main application. However, the first window now moves behind the main application. Thi...

Get a Framework element from a Storyboard

I have a reference to an instance of a Storyboard object, and want to get hold of the Framework element that it is attached to / animating. I haven't been able to come up with any way of doing this. For example, in the XAML below, can I go from a reference to the Storyboard to get hold of either the Label or the Grid <Grid> <Grid.R...

Creating grid of hexagons

I have to do a "grid" like this: Harmonic table I'm trying to create a ListView with ItemsSource=List<Note> where every odd note in the list is moved on the bottom... Is the ListView the right control? How can I draw an exact hexagon with faces that is near next object? EDIT: hexagon drawing is solved... this is the xaml <Path d:Lay...

Bind to an attached behavior on a Storyboard

I have created an attached dependency property for Storyboards, with the intention of enabling me to call a method on my ViewModel when a Storyboard Completed event fires: public static class StoryboardExtensions { public static ICommand GetCompletedCommand(DependencyObject target) { return (ICommand)target.GetValue(Comp...

Tabbing between elements of a view in WPF/xaml

Hello, I'm trying to setup the tab keyboard control options on my current WPF project in xaml. Essentially, I've got a TextBox element within a view, within another view, within another view. Anyway, when pushing tab on the keyboard, it starts cycling through various elements of the container views and eventually goes to the TextBox I ...

XAML Refactoring - How to extract common markup

I have some xaml pasted at the end of this question. It's from a resource file in my project. The HierarchicalDataTemplate and the DataTemplate share exactly the same structure. Is there a way to extract the common parts and reference it in? <HierarchicalDataTemplate DataType="{x:Type local:ChapterViewModel}" ...

How to insert XAML into RichTextBox?

A XAML text stored in database, how can I show its text in a RichTextBox after reading the XAML by XmlReader? StringReader stringReader = new StringReader(xamlString); XmlReader xmlReader = XmlReader.Create(stringReader); rt.Document = ??? ------UPDATE------------------- here is the xamlString contents: <Section xmlns="http://schema...

How can I apply a GradientBrush to multiple consecutive objects in XAML?

I have a TextBlock and a Line sitting next to each other in their own exclusive StackPanel. I need to spread my LinearGradientBrush across the two objects, rather than shading them individually. My project currently looks like this: <StackPanel Orientation="Horizontal"> <TextBlock VerticalAlignment="Bottom"> SomeT...