xaml

XAML - In C#

Hi just trying to get my head around XAML. Thought that I would try some writing XAML in code. Trying to add a grid with 6 by 6 column definitions then add a textblock into one of the grid cells. I dont seem to be able to reference the cell that I want - there is no method on the grid that I can add the textblock too. Just grid.ch...

What is the value-binding syntax in xaml?

I'm getting all learned up about binding in WPF. I'm having a lot of trouble debugging the parse errors in my xaml, though. Can somebody pretty please tell me what's wrong with this little piece? : <Border Name="TrackBackground" Margin="0" CornerRadius="2" ...

WPF: How to style or disable the default ContextMenu of a TextBox

Apparantly when users right-click in our WPF application, and they use the Windows Classic theme, the default ContextMenu of the TextBox (which contains Copy, Cut and Paste) has a black background. I know this works well: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.co...

WPF Image UriSource and Data Binding

I'm trying to bind a list of custom objects to a WPF Image like this: <Image> <Image.Source> <BitmapImage UriSource="{Binding Path=ImagePath}" /> </Image.Source> </Image> But it doesn't work. This is the error I'm getting: "Property 'UriSource' or property 'StreamSource' must be set." What am I missing? ...

XAML - Accessing static fields

How does one go about referencing a class's static properties in xaml? In other words, I want to do something like this: C# Class BaseThingy { public static readonly Style BaseStyle; ... } XAML <ResoureDictionary ...> <Style BasedOn="BaseThingy.Style" TargetType="BaseThingy" /> </ResourceDictionary> What is the syntax to do...

Speeding up XAML editing in VS2008

When editing XAML in VS2008 SP1, the editor is really slow. devenv process seems to be around at 40% CPU (the machine I’m using at the moment is only dual core, so that’s almost maxing out one core) most of the time. It spikes up a bit more when I switch to another XAML file. I do also have ReSharper installed, but I think I’d rather put...

How can I extract a part of a xaml object graph via linq to xml?

I have an object graph serialized to xaml. A rough sample of what it looks like is: <MyObject xmlns.... > <MyObject.TheCollection> <PolymorphicObjectOne .../> <HiImPolymorphic ... /> </MyObject.TheCollection> </MyObject> I want to use Linq to XML in order to extract the serialized objects within the TheCollect...

How can I reformat XAML nicely in VS 2008?

Visual Studio 2008's XAML editor (SP1) cannot reformat the XML into a consistent style. Which tools can I use to get a nicely formatted XAML file? Studio integration preferred. ...

Where do I start designing a Custom Control that contains child objects?

I think this is a fun engineering-level question. I need to design a control which displays a line chart. What I want to be able to do is use a designer to add multiple Pens which actually describe the data and presentation so that it ends up with Xaml something along these lines: <Chart> <Pen Name="SalesData" Color="Green" Data=".....

XAML to SVG?

How would you go about converting XAML to SVG and vice versa? My initial approach it to use xslt to map the different elements and attributes, but I don't know enough about both syntaxes to even guess about the plausibility of such an approach. ...

How do I make custom MenuHeaders in WPF with accelerators?

I'd like to make some custom MenuHeaders in WPF so I can have (for example), an icon and text in a menu item. Normally using MenuItems, if you populate the Header field with straight text, you can add an accelerator by using an underscore. eg, _File However, if I wanted to put in a UserControl, I believe this function would break, how ...

Is knowing blend required?

Do you expect your WPF developers to know expression blend? Any good resources for learning more about Blend? [UPDATE] Does knowing blend make you more productive? ...

How do I stub data for designers when using Expression Blend and Visual Studio?

We are trying out Visual Studio 2008 and Expression Blend on a new project. The goal is to clearly define the role of the developer and designer as separate, but reap the benefit of the developer being able to directly consume the XAML produced by the designer. For the most part this has worked great, and I really like the possibilities...

WPF: Org Chart TreeView Conditional Formatting

The company has the traditional complex organizational structure, defining the amount of levels using the letter 'n' rather than an actual number. I will try and express the structure I'm trying to achieve in mono-spaced font: Alice ,--------|-------,------,------, Bob Fred Jack Kim Lucy | | Charli...

Silverlight- DataGrid control - Selection Changed event interfering with sorting

I'm currently playing with the Silverlight(Beta 2) Datagrid control. Before I wired up the SelectionChanged event, the grid would sort perfectly by clicking on the header. Now, when the grid is clicked, it will fire the SelectionChanged event when I click the header to sort. Is there any way around this? In a semi-related topic, I'd ...

Scalable Moebius strip in WPF

A moebius strip is a surface with one side. How would one define such an object in XAML/WPF? How could such an object be manipulated in 3D, scaled up and down and rotated using C#? ...

How to transform a XAML/WPF file to a video (AVI, WMV, etc.)

I have a simple WPF (XAML) file that has some animated shapes and text. The animation has no interactive behavior. I want to record this animation as a video file that I later intend to use as the "intro" screen to a screencast. What I think I need: C# code that takes an input XAML file and spits out a high quality WMV at (for example a...

How to Set Grid Column MaxWidth depending on Window or Screen Size in XAML

I guess the title says it all. I have a 3 column grid in a window with a GridSplitter on the first column. I want to set the MaxWidth of the first column to a third of the parent Window or Page Width (or ActualWidth) and I would prefer to do this in XAML if possible. This is some sample XAML to play with in XamlPad (or similar) which sh...

What is the best way to localize a WPF application, sans LocBAML?

There seems to be no good way to localize a WPF application. MSDN seems to think that littering my XAML with x:Uid's, generating CSV files, and then generating new assemblies (using their sample code!) is the answer. Worse, this process doesn't address how to localize images, binary blobs (say, PDF files), or strings that are embedded ...

Silverlight Datagrid Control - How do I stop the sorting on a column?

Continuing my problem from yesterday, the Silverlight datagrid I have from this issue is now causing Stack Overflow errors when sorting a column with a large amount of data (Like the text column that contains a where clause for a SQL statment). When you sort, it'll fire the SelectedIndexChanged event for the datagrid and then still try ...