xaml

How to convert Silverlight XAML to Resource dictionary in Silverlight 2

I am looking for the quickest and easiest way to combine two silverlight projects. Once has controls all in Silverlight XAML the other is template driven and uses a template based on a Silverlight resource dictionary. I am looking for some advice and resources on the best and quickest way to do this. One project is based on this: Silve...

IronRuby and XAML Databinding

Does anyone know if Microsoft plans on implementing XAML (declarative) databinding of IronRuby objects for Silverlight and WPF? Without it, using IronRuby for Silverlight/WPF development really isn't all that compelling (IMO). ...

How do I bind to a RowDefinition's height?

In this example code, I'm trying to offset the Grid's Canvas position by the height of one of its rows. Does anyone see what I might be doing wrong? As you can see, I tried moving the binding lower in the xaml file, just in case the RowDefinitions needed to be defined first. Either way, it doesn't seem to matter because Canvas.Top is...

Lighter-weight elements - how does one gauge/know the weight of an element?

I'm working on the UI side of a WPF project. My favourite reference while xaml'ing (besides stackoverflow :) ) at the moment is Adam Nathan's "Windows Presentation Foundation Unleashed". He gives the following tip regarding control templates: "Rather than using a ContentControl inside a control template, you should use the lighter-weight...

Is it possible to use multibinding in WF (with ActivityBind) ?

I would like to bind multiple dependency properties of other activites to a dependency property (of type object[]) in my custom activity. Is it possible to define this multibinding : In the workflow markup (probably somehow combining multiple ActivityBind's) Set up the property editor in such a way that I can even edit this binding in...

WPF: Cannot set items of a read-only collection in XAML

The scenario is really simple. I have a read-only collection property of my custom control, and I want set the items of the collection in XAML. Like this: <l:CustomControl> <l:CustomControl.ControlItems> <l:CustomItem /> <l:CustomItem /> </l:CustomControl.ControlItems> </l:CustomControl> The ControlItems property has in...

Why does the Image element give me a design-time error with "add as link"ed images?

I need to display an image, which I've done without problems before, but today I decided to be tricky and use "add as link" instead. Well, now I get: The file Images/hello.png is not part of the project or its 'Build Action' property is not set to 'Resource'. Wait... its Build Action is set to Resource. I've seen a Silverlight soluti...

Hmm... "add as link"ed images don't show up at runtime.

Sorry guys, I posted this earlier today where my "add as link"ed images were giving me a design-time error. I got assistance with that and now my code compiles, but now the images don't even appear when my application runs. Just for giggles, I changed the Build Action for the images, and nothing made a difference. Is there anything I ...

Is there a way to include namespaces in xaml so I don't have to write the extension?

Is there a way to do 'using' in XAML i.e. declare a namespace and include it in the general xaml scope so I don't have to write namespace:Class, just Class. ...

WPF, Treeview and kinda special herarchical Data Template

Hello I have been searching the internet for two days and wasn't able to find any solution to my problem. Here it is. I have a data structure in wich you can find "Curves" objects and "CurveTypes" objects. A CurveType contains a collection of other curvetypes (category/subcategories). A CurveType also contains a collection of Curves ...

x:Static markup extension

I have a Window.Resource object and the next statement <CollectionViewSource Source="{Binding Source={x:Static Application.Current}, Path=someProperty}" x:Key="someView" /> But what if I need to point to a public property in the Window's code-behind, not the App's? I've tried to use 'this' instead of 'Applic...

Problem with derived ControlTemplates in WPF

The following xaml code works: <Window x:Class="DerivedTemplateBug.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DerivedTemplateBug" Title="Window1" Height="300" Width="300"> <Button> <Button.Template> <ControlTemplat...

XAML get new width and height for Canvas

I have searched through many times but have not seen this before. Probably really simple question but can't wrap my head around it. Wrote a VSTO add-in for Excel that draws a Grid dynamically. Then launches a new window and replaces the contents of the Canvas with the generated Grid. The problem is with printing. When I call the print p...

How do bind a List<object> to a DataGrid in Silverlight?

I'm trying to create a simple Silverlight application that involves parsing a CSV file and displaying the results in a DataGrid. I've configured my application to parse the CSV file to return a List<CSVTransaction> that contains properties with names: Date, Payee, Category, Memo, Inflow, Outflow. The user clicks a button to select a fi...

How do I format the contents of a DataGrid cell as a Date? as Currency?

I have a Silverlight DataGrid that's being populated with different types of data for each column. I'm trying to figure out how to format some of the contents of the DataGrid's cells, specifically for dates and formatting. I have a date column that's currently displaying like: 3/11/2010 12:00:00 AM. I would rather it display like 3/...

WPF Menu Items Styles

Hi, I have an application resource of the following <Style TargetType="{x:Type TextBlock}"> <Setter Property="Background" Value="{DynamicResource windowTextBackColor}"/> <Setter Property="Foreground" Value="{DynamicResource windowsTextForeColor}"/> </Style> So all the text blocks in my application should assume those colours....

In pure XAML, is it possible to get a Line to align to part of a Grid?

Is it possible to create a Line in XAML (without any C# code behind) to align a line inside of a layout container such as a Grid? I'd like to effectively have: <Grid> <Line StrokeThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Stroke="Red"/> </Grid> I need to use StrokeDashA...

Current Date in Silverlight XAML TextBlock

I am coming from Flex where you can do just about anything inside of curly braces. I am trying to get a TextBlock to display today's Date and Time without just coding it in C#. I have tried many different variations of the following with no luck. TextBlock Text="{Source=Date, Path=Now, StringFormat='dd/MM/yyyy'}" I know I could probab...

How do I stop a routed event from triggering on specific places in XAML?

I have the following situation: A stackpanel contains a number of elements, including some that are contained in a GroupBox. So something like this: <StackPanel x:Name="stackpanel" Background="White"> <TextBlock Text="TextBlock"/> <TextBlock Text="Another TextBlock"/> <!--plus a load of other elements and controls--> <...

Animate button on MouseOver and MouseDown

I'm making my own ControlTemplate for a standard Button in WPF. I want to change the background of my button when the user hovers over the button with the mouse, but also when the user presses the button (to yet another color). This seems like a common behavior, but I can't get it to work. My template consists of a Border with an Image ...