xaml

XamlReader of XPS files throws cannot find resource.

I trying to read in a XPS file with XamlReader.Load ( XMLReader ). Some XPS files read in and I can walk through perfectly. One of the XPS files I am working, that displays correctly in IE, gives the following exception: Cannot convert string '/png/1.png' in attribute 'ImageSource' to object of type 'System.Windows.Media.ImageSource'. C...

Append/replace menu items from within xaml and C#, based on user action

I have an app that allows the user to manipulate different types of data (images, text, whatever). When the user is working with one of these custom User Controls, I want to append a new drop down menu to the main menu. For example, in my ImageEditor User Control, I have the following xaml: <UserControl.CommandBindings> <CommandBin...

How to set the default value property for an object represented in XAML

Hi, Say i have an object like class Item { string Value {get;set;} } class MyClass { List<Item> Values {get;set;} } How can i make it so that when i'm using this object in XAML, i can set the value property like so. <MyClass> <Item>A</Item> <Item>B</Item> </MyClass> ...

How to implement nonscrolling ItemsControl with "more..." entry, aka Paging Control?

I need a control that implements the usual functionality an ItemsControl, with the following behavior: If number of items to display does not fit into available space, instead of showing the scrollbar, the number of displayed items is reduced to be able to fit, while leaving available space for a "More..." or "< >" elements. When numbe...

Find the Label for a Targeted UIElement in WPF

Hello, I have the following XAML: <StackPanel> <Label Target="{Binding ElementName=txtSearch}" Content="_Search:" /> <TextBox x:Name="txtSearch" /> </StackPanel> I have an extension method that accepts a UIElement parameter like so: static public class MyExtensionMethods { static public string GetLabelText(this UIElement...

XAML, binding Width and Height properties to the same properties of other control

I'm trying to create a reflection effect and it's working great except that I have to hard-code some values. This is my XAML: <Grid> <Grid.RowDefinitions> <RowDefinition Height="60"/> <RowDefinition /> <RowDefinition Height="80"/> </Grid.RowDefinitions> <StackPanel Grid.Row="1" VerticalAlignment="Cen...

What is the XAML equivalent for binding SelectedIndexProperty in .cs .net silverlight code?

I have been playing with bindings in silverlight, and have figured out how to bind in code, but would prefer to keep the binding in the XAML. This is the code that works in my .cs file: System.Windows.Data.Binding IDBinding = new System.Windows.Data.Binding("ID"); IDBinding.Source = MyTrans; IDBinding.Mode = S...

XAML with inline JavaScript

Hi :), Is it possible to insert Javascript code into XAML? Thanks Q ...

Writing XML Exactly as XML Literals are Written

I'm transforming some XML from DrawingML to XAML. Unfortunately, the XAML one is not working as expected with white spaces, but I have found a work around. Here's the problem: Problem Statment I want to write the following in a TextBlock: Hi John, what did Sushi A say to Sushi B? So I would write: <TextBlock> <Run>Hey</Run> ...

FlowDocument with dinamyc content (BlockUIContainer)

Hello everebody. I write simple xaml-file in notepad: <FlowDocument AllowDrop="True" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;&lt;Paragraph /> <BlockUIContainer><Button Tag="another.xaml">Next...</Button> </BlockUIContainer></FlowDocument> This file contains BlockUIContainer with Button inside. Button also ...

save formatted string as xaml

Greetings, We would like to create some text editor for our clients in our software. We would like to have a simple options like: bold, underline, italic, hyperlink. Then i would like this message to be saved in db as xaml and then just bind the xaml string to my Content Control. The xaml can be as follows: <TextBlock> <TextBlock.Text...

DSL, XamlDOM (.NET 4 Beta) and extending vs2008

I have the following situation: I want to develop a DSL. To generate the code, I would need the help of the XamlDOM Implementation, which offers static analysis and manipulation of XAML Code. Unfortunately, XamlDOM can only be used with .NET 4. I wouldn't have a problem using the vs2010 and .NET 4.0 Betas, but I need to target the DSL f...

Trying to get value of a slider from parent control

Hi all, I'm Trying to get the value of a slider thats contained in a window from a usercontrol thats also contained in that window. this is what i would like to accomplish. <Window x:Class="TestApp3.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"...

The XAML Principle

Of so clear separation of UI is unique to XAML? I mean, you could even customize the entire UI of a 'pre-packaged control/component'... Any light on other technologies that achieve this? ...

Silverlight application resources for global access to a singleton

I have a singleton which once hit will load user profile information, I want to make it an application level resource in my SL3 application so that elements across the application can bind to it. My code version of the instantiaion is a simple UserProfile x = UserProfile.GetInstance(); I want to be able to do this in xaml in the app...

Do I need a converter to parse and bind an enum

In my database I have a 2 columns (Kind and Priority) that are of type int. I also have an enum with the values of Kind and Priority. But when I try to display them into a GridViewColumn, it shows the integers and not the enum values. Do I need a converter Here is the enums: public enum Kind { None = 0, Task = 1, Assignment ...

SVG/XAML: Defining a path which looks like an arrow

I'm trying to use SVG (really XAML) to define a path which looks like a downwards pointing arrow. | | \ | / \ | / \ / ` It is super-important that the edge of the arrow is sharp. I have tried with various combinations of M, L and z with no success. ...

Blend "Window is not supported in a WPF Project"

I am having a frustrating time with Blend reporting "Window is not supported in a Windows Presentation Foundation (WPF) project." due to unbuildable configurations but can't quite work out how to mangle my way out of it. I've worked out it is probably due to my trying to have a single solution with x86 and x64 configurations. There is n...

WPF Set value by trigger when using binding

Why will not this work: <Button Width="200" Height="50"> <Button.Style> <Style TargetType="Button"> <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource Self}, Path=Height}"/> <Setter Property="Background" Value="Blue"/> <Style.Triggers> <Trigger Property="Button.Is...

How to add Type Parameters to XAML

I have the following class: public class DefaultDropTargetAdvisor : IDropTargetAdvisor { I decided to make it have a generic parameter: public class DefaultDropTargetAdvisor<TDragType> : IDropTargetAdvisor where TDragType : class { This was my XAML before the change: <local:DefaultDropTargetAdvisor x:Key="targetAdvisor1"/>...