xaml

Why does the animation I copied in from Expression Blend to Silverlight VS project only run once?

In my Silverlight application, I want different texts to repeatedly fly in from the right changing colors and getting smaller. The animation works the first time through the loop but not subsequent times. Here's what I did: (1) I went into Expression blend, used the "Create Storyboard" tool to create the animation. then (2) copied th...

Inserting an HTML fragment into a WPF FlowDocument

I'm dynamically building a WPF FlowDocument from a datasource. One of the data elements is a fragment of HTML - I need to figure out a way to parse that and insert it into my FlowDocument. I've found HTMLToXAMLConverter which will return a XAML representation of the HTML, but I'm still not sure how to best go about instantiating that X...

Why is my text cropped?

When i try to add a text block to a border element, i only see part of the text. I rotate the text after adding it to the border and that is causing the problem. Increasing the width of the border fixes this issue. But, my border needs to be only 20 units wide. What am i missing here? <Border Name="BranchBorder" ...

WPF - MergedDictionary using RibbonControlsLibrary in xaml

In code behind, this works: this.Resources.MergedDictionaries.Add(Microsoft.Windows.Controls.Ribbon.PopularApplicationSkins.Office2007Black); How do I do this in xaml? ...

Set Parent Visibility to nested Child Visibility

I have the following <ControlTemplate x:Key="RoundedTopPanel" TargetType="{x:Type ContentControl}"> <Grid> <Border CornerRadius="9.5, 9.5, 0, 0" Padding="10" > <ContentPresenter/> </Border> </Grid> </ControlTemplate> and then use it as <ContentControl Template="{StaticResource RoundedTopPanel}" Grid.R...

Animation in DataGrid of Silverlight Application - How?

I'm starting to kick Silverlight around (although it currently feels the other way around) by rewritting an existing ASP.NET application - as good a place to start as any I thought. I have 'mastered' pulling data from a database, through a service and into a datagrid and also populating image elements in the rows. So far so good. Now i...

wasn't there a way to generate an event handler from the XMAL editor in a silverlight project

Not wanting to enter into the debate of wiring up event handlers in code or in XAML, sufice it to say, that I seem to recall there was a kind of "tab to create" feature in the XAML editor for silverlight projects. Clearly it's been a while since I have been codeing XAML, but I was sure it was a simple process of adding an event handler ...

Binding complex properties in Silverlight/WPF

Lets say I have a custom data type that looks something like this: public class MyDataType { public string SimpleProp1; public string SimpleProp2; public List<SomeType> ComplexProp; } now I hava a data bound control (i.e. ItemsControl or DataGrid), that is created dynamically. How would the binding defined in xaml code look like...

WPF input gesture

Hi I am working a WPF application, where I have maintained a Menu Bar with Input Gestures i.e keyboard Shortcuts. For Save As menu item, I have kept Ctrl+A as per User's requirement. It works fine as far as the focus is on the main window. Now my problem is, suppose use has navigated in some Listbox in window, and if he presses Ctrl+A...

Load WPF styles (static resources) from an external assembly

I have a few WPF applications and I want all my styles to be in a shared assembly instead of declaring them in each application separately. I am looking for a way so I don't have to change all my Style="{StaticResource BlahBlah}" in the existing applications; I just want to add the reference to this style assembly, and delete it from th...

Why would INotifyPropertyChanged only fire when at least TWO characters are changed?

I finally got a Silverlight MVVM example to work so that when I change the values of first name and last name text boxes, the full names change automatically. However, and strangely, my model which inherits from INotifyPropertyChanged is only notified if I change at least 2 characters of either the first or last name. if I change "Sm...

Load a ResourceDictionary from an assembly

I've got an assembly somewhere on the file system, e.g. "C:\temp\test.dll". In that assembly there's a ResourceDictionary, e.g. "abc.xaml". How can i get that ResourceDictionary? Maybe there is a way using Reflections? I didn't find a solution so far. Thanks in advance! Edit: Just wanted to add that I want to access the Resources in t...

How to get intellisense when doing XAML data bindings?

It would be nice if in XAML when I define ItemsControl/ItemsSource="{Binding AvailableContracts}" that Visual Studio would be smart enough to go find the property AvailableContracts on the ModelView which the DataContext is bound to, reflect it, and then when I type: <TextBlock Text="{Binding Path= it would pop up intellisense of the ...

WPF "Skinning" ie Replacing a window layout with a totally different one

WPF Noob question: Can WPF applications can have their appearance change at runtime? I understand, through styles, that one can change the appearance of controls and UI elements, but I was envisoning something more along the lines of having two applications: one "editor" application and a "game" application, both running essentially the...

Silverlight - Binding with ObservableCollections

This is no doubt a newbish question, but I have looked for an answer to no avail. My setup is simple: I have a ListBox control defined in XAML and an ObservableCollection<MyClass> in the same class. I am binding the ObservableCollection<MyClass> to the ListBox. Within the hierarchy of this ListBox in XAML, I want to bind to a given My...

Silverlight - Binding to my UserControl causes ManagedRuntimeError

I am getting a run-time error when I use DataBinding, and it is driving me crazy. I have a simple UserControl that I have defined, let's call it SillyControl. Separately, I have a collection ObservableCollection<MyClass> myObjects; and a ListBox called SillyListBox which is bound to this ObservableCollection via: SillyListBox.ItemsS...

Handling missing image files when displaying XAML

I'm using XamlReader.Load() to load an external XAML file which may contain some images and other media. I'm using ParserContext to set the baseUri, so if the paths inside the XAML file are correct, the media is loaded successfully. // works var pc = new ParserContext(); pc.BaseUri = new Uri(baseUri, UriKind.RelativeOrAbsolute); using...

Rename XML namespace prefixes

I have an XML (XAML) string that looks something like: <Zot xmlns="clr-namespace:A.B;assembly=A" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; </Zot> The Silverlight XamlReader class is unable to load this string, it needs a particular default namespace: <z:Zot xmlns="http://schemas.microsoft.com/winfx/2006/xa...

[WPF] How do I add dynamic spacing between controls? (with pics)

My question is simple. What is the best way to achieve what you see the pic below in WPF? At the moment this is a horizontal StackPanel, with the right padding of the checkbox set to 90. This works okay, but if you resize the window it's no good anymore, unless maybe you re-adjust the padding in the window's resize event, but that seems...

wpf in-page dialog.

When I worked on web pages I used these a lot. While building a page out for WPF project the other day I ended up building a page that looked like it had an in-page dialog on it but it was the only thing on the page. My question here is. Has any one created such component that allows for easy creation of these kinds of dialogs. ...