xaml

Possible to use XmlDataProvider with d:DataContext?

I'm wondering how I can use an XmlDataProvider to provide arbitrary XML data for design time use in Blend 4. I've tried a few ways of specifying it but Blend doesn't pick it up. My UI elements end up blank. I realize Blend has functionality to generate and manage sample data but that's a lot of overhead for some of the simple user contr...

Silverlight: Limiting or Filtering Datatypes in Hierarchical Data Binding in XAML

So I'm binding to a generic datasource that's comprised of different types of classes. I'd like to filter the tree based on the class types. I.e., I don't want the tree to show a node at all for certain types of classes. Has anyone run into this? ...

Deciphering which control fired an event

I have an application with many images that all look the same and perform similar tasks: <Image Grid.Column="1" Grid.Row="0" Name="image_prog1_slot0" Stretch="Uniform" Source="bullet-icon.png" StretchDirection="Both" MouseDown="image_prog1_slot0_MouseDown"/> <Image Grid.Column="1" Grid.Row="1" Name="image_prog1_slot1" Stretc...

Should we use server generated XAML to deliver our Silverlight/WPF UIs?

Back in January 2009, Dino Esposito published an article on MSDN titled "Managing Dynamic Content Delivery In Silverlight". We are considering using an approach like this for an upcoming project and were wondering if anyone had any advice on whether this is a good approach. Are there any traps or pitfalls we should look out for? We curre...

Using Japanese characters in WPF/XAML

I want to display Japanese chars in my WPF application: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> <Grid> <TextBlock Text="はい" FontSize="30" /> </Grid> </Window> ...

SilverLight 3 Beginner question: Scroll with mousewheel and zoom image with panning

Hello, I would like to make a small silverlight app which displays one fairly large image which can be zoomed in by scrolling the mouse and then panned with the mouse. it's similar to the function in google maps and i do not want to use deepzoom. here is what i have at the moment. please keep in mind that this is my first silverlight ap...

WPF app startup problems

My brain is all over the map trying to fully understand Unity right now. So I decided to just dive in and start adding it in a branch to see where it takes me. Surprisingly enough (or maybe not), I am stuck just getting my darn Application to load properly. It seems like the right way to do this is to override OnStartup in App.cs. I'...

Silverlight 4 Toolkit Chart question

Silverlight Chart Legend Style With Silver Light 4 Tool Kit April 2010 Going off various examples I have found on the web, I am trying to set the legend style so the items are side by side. Error returned “cannot find Style Property ‘ItemsPanel’ on the type ‘System.Windows.Controls.DataVisulization.Legend’ <chartingToolkit:Chart.Legen...

Confusion about WPF binding...

I am trying to bind a 2D array of buttons arranged in stackpanels to a 2D ObservableCollection... Yet, I'm afraid I don't understand something very elementary about binding. My XAML: <Window.Resources> <DataTemplate x:Key="ItemsAsButtons"> <Button Content="{Binding}" Height="100" Width="100"/> </DataTemplate> <...

WPF: Binding with title and subitems

I am having some issues trying to learn WPF. What I am trying to do is to bind a class that has a string and an array of strings. I would like to bind the string as the title and array as the contents of an expander, but I am having difficulties. What am I missing to make this work? Any help would be appreciated, TIA. This is the co...

How do you debug a XamlParseException?

I'm trying to use a 3rd party component in my Silverlight application and when I try to create an instance of the control, I get a XamlParseException: {System.Windows.Markup.XamlParseException: Set property 'System.Windows.FrameworkElement.Style' threw an exception. [Line: 0 Position: 0] ---> System.Windows.Markup.XamlParseException: El...

Desine time XAML serialization problem in VS2010 Designer

The wired problem is, in VS 2008, everything works fine. In VS2010 while serializing, it is missing the "ReportDimensionElements" so I'm unable to get the values back from the serialized value back from the XAML. It says, "'ReportDimensionElements' is null" am I missing anything silly. Note: I have marked the ReportDimensionElements cla...

App.Config or XAML

Hi ladies(?) and gents, I am currently evaluating my options for a rewrite of the projects I'm working on and I am a bit miffed by the stringly-typed nature of our app.config files. I'd like to move to a more structured approach, so I have two options: Use custom SectionHandlers in the app.config Scrap app.config and use XAML instead...

WPF Reusing Xaml Effectively

Hi, I've recently been working on a project using WPF to produce a diagram. In this I must show text alongside symbols that illustrate information associated with the text. To draw the symbols I initially used some png images I had produced. Within my diagram these images appeared blurry and only looked worse when zoomed in on. To impr...

How do I programatically load a XAML Resource Dictionary located in another assembly?

I have seen this this post that shows how to do it from XAML, but how can I get a ResourceDictionary object from a Resource dictionary located in a different assembly? The XamlReader.Load has an option to take a filename parameter, but I dont think it works with the pack uri syntax. Any ideas? ...

How do you color a rectangle in C# that has been declared in XAML in WPF?

How do you color a rectangle in C# that has been declared in XAML in WPF? There is a rectangle control in XAML. In my C# code there are times in which it would be nice to fill the background color. How does one do this? ...

Why does VerticalScrollBarVisibility not work in a style in Silverlight?

VerticalScrollBarVisibility works when I define it inline like this: <UserControl x:Class="TestScrollBar.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas....

#region in XAML

I actually don't like #region in my code. BUT for some reason call me crazy, I would like to have them in my XAML. I would like whole sections to have a #region-like thing and collapse them (e.g. my <Window.CommandBindings>, <Grid.*Definitions>, <Menu>, <Toolbar>, etc.. Does this exist? If not, how about <RegionCollapse> ...

Binding to an ObservableCollection of UserControls

Simple Silverlight question: I have an ObservableCollection<MyObject> in my viewmodel. Every MyObject has a Label property. If I bind a ListBox to the collection and set DisplayMemberPath to Label, or set the ItemTemplate to a TextBlock that binds the Text property to Label, all works as expected. If I change MyObject so it derives from...

WPF Expander Button Styled so it is inside Expander Header

I am using the expander control and have styled the header as shown in the picture below. The problem I have is that I want the expander button to be contained within the header so that the line for the end of the header template aligns with the Expander content i.e. I ultimatly want to end up with something similar to the image below...