xaml

How do i add a second code behind file to a xaml file?

In visual studio i want to add a second code behind file to a xaml window (my main form). i know i can have another (or as many) files that form partial parts of a class, and if they are in the same project they will be included, but can i make more than one file sit in the expander (in the solution explorer) when i expand the xaml file ...

How to force WPF to use resource URIs that use assembly strong name? Argh!

O.k, this is really irritating, I had noticed previously that the code generated by WPF for loading XAML resources did not appear to use strong names and therefore may be problematic for scenarios where you need to support side by side versions of WPF assemblies. This has turned out to be the case, and it's now causing me problems - I h...

Where to find WPF Classic Theme as XAML?

I am creating some custom controls in WPF and need to therefore create the default control templates for them. To help in this process I would like to see the XAML of the control templates for the builtin controls as a reference. I can open up the PresentationFramework.Class dll into .NET Reflector but cannot find anything inside it of ...

How can I create a simple 2D NURBS using XAML?

I need to create a spline with two endpoints and 'n' control points. As far as I am aware, a Bezier curve allows for only one control point, and a Bezier spline allows for two control points. However, I need to be able to add as many control points as I see fit, not limited to one or two. Here is an example of what I want to achieve, wi...

AutoCompleteBox not retaining text

I have a Silverlight test project where I'm returning a List< ProductInfo > ... public class ProductInfo { public override string ToString() { return Name + " - " + Description; } public string Name { get; set; } public string Description { get; set; } } It is successfully returning the name and descripti...

Is it possible to Left-Align headers in a WPF TabControl?

Right now, I have a WPF window that looks like this: I'd like it to look like this (Photoshop doctored image): Is this possible without completely redoing the ControlTemplate? I tried messing with HorizontalAlignment, HorizontalContentAlignment, etc., but nothing I tried had the desired effect. Edit: If I try this solution (of...

How to use Path in a DrawingImage?

I have some paths defined that I would like to convert into DrawingImage resources but I must be missing something. i.e. I want to take something like this: <Path Stroke="DarkGoldenRod" StrokeThickness="3" Data="M 100,200 C 100,25 400,350 400,175 H 280" /> and use it with something like this: <DrawingImage x:Key='icon'> ...

Selecting a ListBoxItem when its inner ComboBox is focused

I have a DataTemplate that will be a templated ListBoxItem, this DataTemplate has a ComboBox in it which when it has focus I want the ListBoxItem that this template represents to become selected, this looks right to me. but sadly enough it doesn't work =( So the real question here is within a DataTemplate is it possible to get or set th...

How to add a "type here" message to a WPF TextBox?

If the text box has no keyboard focus and no text, then show italic gray "type here" text "inside" it. How? What doesn't work: Setting the Text property - it messes up data binding. Overriding the template - it's messy and overridden already anyway. Preferably, I'd like the solution to be as much XAML and as little C# as possible. Pe...

WPF layout riddle

Say I've got two elements in a window. I'd like element A to fill all unused vertcial space and have always at least eg. 200px height. Element B will have few fixed sizes (expander) and it should be given the space it demands (but leaving at least 200px for A). If there is not enough free space in a window, B should be scrollable. That...

WPF Simple Binding to an objects property

Hi, Im having some problems with binding in wpf/xaml. Have this simple file: <Window x:Class="test.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <TextBlock Height="21" Foreground="B...

How to remove the dropdown icon on a WPF ToolBarTray?

How can I get rid of the grey dropdown area to the right of the text in the toolbar item below? Here is the code which produces it: ToolBar tb = new ToolBar(); tb.Background = new SolidColorBrush(Colors.Transparent); Button button = new Button(); button.Content = "test"; button.Click += new RoutedEventHandler(button_Click); tb.Items....

How to make a StackPanel Width that of another StackPanel?

I have two dockpanels which each have a left StackPanel. The width of the bottom StackPanel is determined by the width of the text is in it. The width of the top StackPanel should be the same as the width of the bottom StackPanel. I've tried to bind the Width of the top StackPanel to the Width of the bottom StackPanel via ElementName ...

Silverlight ListBox Checkbox Selected Item

I have a Listbox, that has a Checkbox as part of the item template. In the click even of the Checkbox, I want to make sure that same list item is selected. ListBoxItem lbi = ((ListBoxItem)listLayers. ContainerFromElement((CheckBox)sender)); lbi.IsSelected = true; The main issue that I'm having is that "Containe...

What's the quickest/easiest way to get example data into ListView/GridView in WPF?

I'm doing some quick design work/rapid prototyping with WPF. I'm curious if anyone has a good strategy for getting example data into a ListView/GridView (or really any ItemsControl for that matter). The example data would either be made up on the fly, or pasted in from somewhere (e.g., an Excel file). ...

Use Ribbon Control in WPF Toolkit in XAML

How to use the Ribbon control in WPf toolkit in my XAML? How to include the namespaces for ribbon in XAML? ...

How to change the DataContext of a button to the parents parent DataContext?

I have 2 Classes in WPF: Meeting People In meeting I have 2 ObservableCollections; AttendingMeeting and NotAttendingMeeting that contain People objects In the xaml the DataContext are set to meeting, and I have 2 DataGrids (AttendingMeeting and NotAttendingMeeting) I need to add a button to each of the DataGrids to add and remove ...

WPF Application that only has a tray icon

I am a total WPF newbie and wonder if anyone could give me some pointers how to write an application that starts minimized to tray. The idea is that it periodically fetches an RSS Feed and creates a Toaster-Popup when there are new feeds. The Application should still have a Main Window (essentially just a list containing all feed entrie...

WPF 3D Gradientbrush problem

The main problem is in LinearGradientBrush. It fills triangle in solid red. What's wrong? I have tried almost the same code with 2d shapes. It worked perfectly. <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1...

How do I sort hierarchical data in WPF?

I am creating a menu that will have its menu items injected into it from different modules (I am using the Composite Application Library: Unity, Prism). Example: File - Open - New - A (injected from ModuleA) - B (injected from ModuleB) - C (injected from ModuleC) - Exit Because I don't know which items will be injected, I need...