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>
...
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 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"...
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...
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...
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...
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...
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 ...
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...
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...
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}"/>
...
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...
I want to work with a DataGrid in Kaxaml. How do I reference the toolkit dll?
...
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.
...
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...
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>
...
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...
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?
...
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...
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?
...