xaml

UserControl that has a generic class in its inheritance tree

I'm trying to create a UserControl that inherits from a generic class. It does not directly inherit from a generic class, but through an intermediate class that does not use generics. This compiles and works at runtime, but I get an error at design time. Here's my generic parent class: Public Class GenericParent(Of T) Inherits Us...

How do you learn WPF and Silverlight?

I've been doing some WPF development for the last few months, and I've recently started Silverlight development. Most of the time things go OK, especially for the simple stuff, but frequently I get stumped by seemingly simple things - especially in XAML. As an example, yesterday I was trying to use a Grid to lay out the items in a ListB...

How do I Change the FontFamily on a ContentPresenter?

I have a custom template for an expander that is close to the code below. I had to change some of the code to take out custom classes, brushes, etc.. <Style TargetType="{x:Type Expander}"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Top" /> ...

Assembly-wide / root-level styles in WPF class library

I have a C# (2008/.NET 3.5) class library assembly that supports WPF (based on http://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/). I've created several windows, and am now attempting to create a common style set for them. However, as it's a class library (instead of a WPF app), ...

WPF design rendering is dramaticaly slow Visual Studio 2008? Are there any tweaks that could speed it up?

I just wanted to do some tutorials in WPF but I find that the designer works very slow in comparision to Windows Forms/GDI+. Are there any tweaks to speed it up? ...

WPF: how to display enum property values in vs2008 xaml editor intellisense?

i created a wpf custom control with a dependency property of an enum type. i want the user of that control when editing the xaml in vs to see the optional values of the enum in the intellisense window. does anyone know how it can be done? ...

Is it possible in Silverlight to bind the column header text of a DataGrid to a resource string ?

I need to bind the column Header text of a DataGrid to a Resource string in a XAML file. Does anybody know if this is possible ? The column Header definition looks like this but I would like to replace the "MyHeaderText" with text from a resource file:- <data:DataGridTextColumn Header="MyHeaderText" Binding="{Binding SomeData}" IsReadO...

XmlDataProvider Source="pack://application:,,,/FinanceExplorer/Equity.xml"

Can someone explain the syntax in the source attribute here? What the heck is "pack:" and "application:" and why 3 commas? I couldn't find any decent desciptions. ...

DataTemplate with TargetNullValue in a ListBox

I have the following DataTemplate in a Listbox <ListBox Grid.Column="1" Grid.Row="2" ItemsSource="{Binding People}" SelectedItem="{Binding SelectedPerson}"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock OverridesDefaultStyle="True" Background="{x:Null}" Margin="0" Padding="0" IsHitTestVisible="True" T...

Passing focus of child element in a UserControl to parent in WPF

I have a complex WPF UserControl made of other ContentControl templates which contain sets of buttons, textfields, and other elements. The parent UC is focusable so I have a style with a property trigger to update (gratuitous OuterGlowBitmapEffect) when the UC has focus. However when the user clicks or tabs to any of the buttons inside ...

XPS or XAML viewer to embed in .NET app?

Is there a viewer object or ActiveX control I can use to embed an XPS document, or an XAML GUI in my .NET application? ...

Setting XAML at runtime?

Can I dynamically create an XAML and pop it into my app? How would it be done? ...

How to render an <image> in a background WPF process ?

I'm taking Silverlight XAML and sending it to a web service that renders the XAML in a STA thread and generates a PNG image. All the XAML renders correctly except the <image> entries which 'appear' to load correctly when their Source property is set in WPF but the PNG does not show the referenced image - what am I doing wrong ? The core...

Using ContentStringFormat property with TextBlock in ControlTemplate

I have a simple ControlTemplate for buttons which creates a link-like look and feel for them: <ControlTemplate x:Key="LinkTemplate" TargetType="{x:Type Button}"> <TextBlock Text="{TemplateBinding Content}"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> <Setter Property="Foreground" Va...

HierarchicalDataTemplate and TreeView binding compilation error

Hi, I have implemented a UserControl and put a TreeView control on that. The XAML file looks as follows. I am using a HierarchicalDataTemplate for data binding with the Treeview, <UserControl x:Class="Trinity.Windows.Viewer.Alarm.AlarmPage.TrinityDeviceTree" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml...

HierarchichalDataTemplate and Treeview compilation error

Hi, I have implemented user control and put TreeView control on that, XAML file looks as follows I am using HierarchicalDataTemplate for databinding with Treeview, <HierarchicalDataTemplate DataType = "{x:Type src:Partition}" ItemsSource ...

XAML to C# conversion tool

Is there a XAML to C# conversion tool? I have a control template defined in XAML, but I want to create this template and it's styles using C#, so I can obfuscate the code version (since I can't obfuscate the XAML/BAML). ...

WPF binding to XPath-reachable value of an element property

I'd like to bind to a value reachable only with XPath from the property of an element. The element is a ComboBox populated from some XML, and its property is SelectedItem. SelectedItem points to an XML element, and I'd like to bind to a child element's value within that, which can be reached with an XPath. The XAML looks like this, so ...

Controlling a UserControl's Storyboard from the parent Window in WPF using only XAML

I have created a very simple test app to try and solve this problem described to me by a co-worker. He was able to trigger it in C#, but I believe he needed the solution to be more generic and wanted it to be done strictly in the XAML. The problem was: How do you trigger the Storyboard inside of a UserControl to begin in response to an...

XAML Template Binding Horizontally

I'm wondering how one could use template databinding to accomplish what the following code produces (a grid of checkboxes with some associated text): int tbIndex = 0; for (int i = 1; i < 5; i++) { StackPanel pan = new StackPanel(); pan.Orientation = Orientation.Horizontal; pan.Margin = new Thickness(3); pan.Name = "RowP...