xaml

Setting IsCheckable seems to prevent submenus from showing up

I'm trying to bind IsChecked to the Selected DependancyProperty on the object I'm displaying, this code appears to work, but submenus don't show up if I use it. Is this the right way to go about it, and how do I fix the problem? <MenuItem Header="Window" Name="windowMenu" ItemsSource="{Binding}"> <MenuItem.ItemContainerStyle> ...

is "non-intrusive code-behind" a good or bad practice?

I am a bit surprised that while learning WPF/XAML/Silverlight almost all of the XAML/C# examples I have encountered have the "Click" events in the XAML and very few in the Window or Page constructor. With all the emphasis these days on "non-intrusive Javascript", I would think that more developers would actually be structuring their XAM...

How to get a TextBlock to right-align?

How do I get the TextBlock in my status bar below to align to the right? I've told it to: HorizontalAlignment="Right" TextAlignment="Right" but the text is still sitting unobediently on the left. What else do I have to say? <Window x:Class="TestEvents124.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"...

Styling a WPF layout grid background (of each cell, row, column)

I would like to know if there is any way to style a WPF layout grid's cells, rows and columns. I've been trying to find any information and the few mentions I've found have not been that informative. I would like to style the grid to look like the one in the linked screenshot. If the actual control does not support it, can I inherit it...

How to add additional attributes to standard XAML elements?

This button click method launches a Window called "(assemblyname).Reports" when a button with Content "Reports" is clicked: private void Button_Click(object sender, RoutedEventArgs e) { Button button = (Button)e.OriginalSource; Type type = this.GetType(); Assembly assembly = type.Assembly; Window window = (Window)assembl...

WPF XAML: how to get StackPanel's children to fill maximum space downward?

I simply want flowing text on the left, and a help box on the right. The help box should extend all the way to the bottom. If you take out the outer StackPanel below it works great. But for reasons of layout (I'm inserting UserControls dynamically) I need to have the wrapping StackPanel. How do I get the GroupBox to extend down to th...

Bind StackPanel.Visibility to the Visibility property of its children

I'm relatively new to DataBinding and just reading into it. What I want to do is the following: I have a StackPanel with a number of child controls: <StackPanel Orientation="Horizontal"> <TextBox x:Name="textbox1" Width="100">1</TextBox> <TextBox x:Name="textbox2" Width="100">2</TextBox> <Tex...

Controlling rendering order (ZOrder) in Silverlight without using the Canvas control

I'm programmatically adding a UserControl to another in Silverlight 2 by adding it to the parent control's "Children" collection. At first this works fine. If I do something else to the window (in my case I'm scrolling the entire panel out of view then back into view) then it apparently changes the render order and causes my control to ...

Focus DataTemplate in WPF

The behaviour I am looking for is that a selection of a Item in a ListView results in focusing the first focusable visualchild. Problem: datatemplated data in a ItemsControler which does not get an initial focus. In the example below there are 4 Strings which are then stuffed into a TextBox via Datatemplate. Example: <Window xmlns="ht...

Can't use WPF designer in VS2008 SP1

Hi, i searched several hours four solution and nothing found. If I open WPF Designer in my VS2008 Team Suite SP1 I become following error: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boole...

How to find a ListView in a DataTemplate?

I have this ListView in xaml <ListView x:Name="PersonsListView" ItemsSource="{Binding}" ItemTemplate="{DynamicResource personLayout}"> <ListView.Resources> <DataTemplate x:Key="personLayout" DataType="Person"> <StackPanel Orientation="Vertical"> <TextBlock Text="{Binding Path=FullName}"/> ...

LINQ to Objects - binding to a ListView

Hi, I've been having a problem binding a ListView to an Object using LINQ. It's best explained with a testcase I've created: C#: using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Windows; using System.Windows.Controls; namespace WpfApplication1 { public partial c...

How do I reference different DLLs in Kaxaml

I want to work with a DataGrid in Kaxaml. How do I reference the toolkit dll? ...

Has anyone had any experience in adding keyboard shortcuts to a silverlight based project ?

Just wondered if anyone could give me some advice on the best way to implement keyboard shortcuts within a Silverlight based project. Can this be done from the xaml or is it best implemented within the code behind etc... Thanks in advance. ...

How do I say .ToString() in XAML?

The following code gives me the error (cannot add type Object to Stackpanel). How can I say .ToString() in XAML? <Window.Resources> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Content"> <Setter.Value> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Bind...

How can I get multibinding to work in XAML ListBox?

The following shows me 3x "MultiTest.Model.Customers" in the ListBox (one for each record it should display). What do I need to change in order for it to output the contents of the fields instead? <Window.Resources> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="ContentTemplate" > <Setter.Value> ...

WPF Dependency Property Data Binding Problem

I created a UserControl in WPF. This user control has several text boxes that are bound to properties on a database object which is referenced by proptery on the UserControl. The xaml looks like: <TextBox Name="_txtFirstName" Text="{Binding Path=Contact.FirstName, UpdateSourceTrigger=PropertyChanged}"/> This worked properly until I...

Is there a way to automatically reformat Blend's XAML view?

Blend tends to create its XAML in very long lines. Is there a way to reformat it so that the properties of each element are lined up vertically under each other? ...

WPF Databinding in XAML

Hello I have little problem with databinding in my current project. I have an ObservableCollection I want to bind to an ListBox. public ObservableCollection<GeoDataContainer> geoList = new ObservableCollection<GeoDataContainer>(); ...later... geoListBox.ItemsSource = geoList; This code works fine. The Listbox has a datatemplate an...

How in Blend to make a shape have blurry edges?

I have one rectangle on top of another. They have sharp edges. I want them to blur together. It seems there is a way to blur them with "Bitmap Effect" but I'm not finding that in my Rectangle property search in Blend. How can I blur the edges of one rectangle so the two don't have sharp edges where they touch? ...