xaml

XAML ScrollViewer scroll bar hidden issue (Silverlight)

I’ve got this strange problem whereby the content within a scroll viewer increases in size, the scroll viewer then shows is horizontal scroll bar. However the grid the ScrollViewer is ultimately within doesn’t seem to resize enough to show the scroll bar. I’ve isolated the problem in this sample app, basically some xaml and some code be...

Attaching an Event Handler to a Code Generated DataTemplate

I have a question related to this one: I'm trying to attach an event to my StackPanel but it doesn't appear to connect when using the XamlReader. I can't get the ChildItem_Load method to get called. Does anyone know of a way to do this? Other than this event the code works fine. this._listBox.ItemTemplate = (DataTemplate) XamlReader.Lo...

XAML & Windows Mobile (.Net Compact Framework)

Is there any support for XAML on the Windows Mobile? ...

Accessing resources in Xaml across projects/dlls

Is it possible to reference Xaml assets stored in a ResourceDictionary (build action = resource) from another project? I would like to either merge the assets into the main project's resource dictionary or access them individual. For example: Project "MyResources" contains a folder named "Assets" which has a ResourceDictionary called...

WPF Trigger based on Object Type

Is there a way to do a comparison on object type for a trigger? <DataTrigger Binding="{Binding SelectedItem}" Value="SelectedItem's Type"> </DataTrigger> Background: I have a Toolbar and I want to Hide button's depending on what subclass is currently set to the selected item object. Thanks ...

WPF - Use a ControlTemplate resource within a Style

When creating a Style, is it possible to set the ControlTemplate property to a previously defined resource? For example, if I had the following in a ResourceDictionary: <ControlTemplate x:Key="MyControlTemplate" TargetType="{x:Type Button}"> ... </ControlTemplate> And then later wanted to use it in a Style like this: <Style x:Key="M...

A grid, a Viewbox, and a Canvas

Ok, I have a Grid which 'auto sizes' to a web browser. In there I have a canvas with shapes drawn onto it. What I want is for the canvas to 'stretch' to fill the page. I tried using a 'Viewbox' from the Silverlight 3 10/09 Toolkit but it does not seem to fill all the space in the grid and only works when I give it an exact pixel count...

How do I theme windows like Google Chrome, with WPF?

You know how Chrome windows are super custom looking and what not, they have a custom title bar that has custom looking minimize/maximize/close buttons. How would I do this with WPF? ...

Localization of text that includes subscript and inline images in WPF

I have a small WPF application that I am working on localizing. I have read thru a number of documents but I have not found a good source of information about dealing with 'rich' content - for example: I have a ui element (TextBlock) that contains a mix of text with formatting, inline images and symbols. I want to localize this element....

WPF - Databind dynamic control type

Hi, I have a Person class. A Person can have an associated control. Can I display the control through data binding? e.g: Name: Bill , Control: TextBox Name: Bob, Control: ComboBox Name: Dan, Control: CheckBox I have the following xaml in my resource dictionary <DataTemplate x:Key="PersonTemplate"> <DockPanel > ...

ScrollViewer Height to automatically scroll when content overflows the page

Ok ,this is going to sound silly, but I can't get the ScrollViewer to work properly. What I need to do is Have a silverlight page use 100% width/height of the HTML page Have a Height=160px control on the top part of the Sliverlight page, then have the rest (100% - 160px) be a ScrollViewer with dynamically changing content. so in th...

WPF - Scrolling Listbox in an Expander

I have an Expander that I want to have a ListBox in. When the I open the expander the ListBox just expands off the screen (rather than expanding to fill what is available and then scrolling) Here is my XAML: <DockPanel Margin="266.25,0,455,12" Name="dockPanel1"> <StackPanel> <Expander Header="expander1" Name="expander1" Wi...

Create Alt-key shortcuts in WPF/XAML

I have a XAML window with multiple TextBoxes, each with a corresponding TextBlock tag for a title. I would like to enable alt-key shortcuts for this window (hold down the alt key to show underlined letters in the TextBlock titles, type one of those letters and focus should change to the corresponding TextBox). I've found out how to do ...

Design-Time Resourcedictionaries

I have created something like this and this. In effect I have a dll which supplies me with a "styler" for my application - it contains all my basic styles as well as a factory to call StylerFactory.DefaultStyler.ApplyStyles(this) on an Application - which merges the supplied ResourceDictionaries with the existing. This way I don't need a...

WPF Height Databinding question

I have an ScrollViewer that I am trying to do data binding on the height of. The ScrollViewer holds a long ListBox So here is my question. My ScrollViewer will bind to the height of my window (Name="MainForm") just fine. But then it is too long. If I try to bind to a grid in the window (Name="MainGrid") then the ScrollViewer expands...

Loading xaml with events and custom classes in to Silverlight frame hosted in html, during runtime

Here's the scenario: A Silverlight app (just a wireframe) that is hosted on an html page (no aspx/server side solution, just a client side html page loaded from c:\somefolder\mysilverlight.html), actually it is hosted in a WPF app using WebBrowser control. The WPF app needs to inject Silverlight xaml in to the Silverlight wireframe dyn...

VS Xaml designer error

Hi, I have an error with my Xaml files in a WPF application. I'm not able to see my control in the Visual Studio designer or in Blend. But, the application compiles and is running perfectly. In Blend, it says that there's an invalid Xaml and the error just make no sens at all, but when I close the control there's no more error. In Vi...

Can I declaratively bind an ItemsContol.ItemsSource to an ObservableCollection in Silverlight?

I can't for the life of me figure out why this doesn't work. I've got a simplified piece of Xaml that looks like this: <UserControl x:Class="Foo.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://sc...

Adding visible elements to a custom Panel in Silverlight 3

As I understand it, a Panel isn't meant to have any visible "chrome." The StackPanel, Grid and Canvas don't have any visible elements (with the exception of the gridlines, which they say are only for debugging layout.) In my example, I am going to create a Custom Panel that uses Attached Properties to lay out its children controls. Ho...

WPF Animation "Cannot freeze this Storyboard timeline tree for use across threads"

I currently have a listbox that has its selected item bound to a property on my ViewModel. Whenever the selected item isn't null I want to perform an animation on it. However I keep getting the following error "Cannot freeze this Storyboard timeline tree for use across threads" and from research sort of understand why this is happenin...