wpf

WPF: Printing a FlowDocument

I'm trying to get a FlowDocument to print. After spending much of the day trying multiple pages I failed and opted for something simpler, but I'm now at a loss to explain when text isn't output to the page. This has to be something I've got snowblind to I think. There are two tables below, placing a converter on both shows that the value...

ProgressBar clips the very top of value

I'm having a slight problem with reskinning a ProgressBar in WPF. Specifically, no matter what I do, it seems to clip the inner indicator at about 99%. I've tried all sorts of things, from clipping to OpacityMask, but I can't seem to stop the top from cutting off. Any ideas what's going on here? Code: <Style x:Key="BarrelStyle" ...

WPF ComboBox which updates its ItemsSource from the database as the Text property changes

I would like to have a ComboBox control on a form which will be used to search a list of investments as the user types. I can do this easily if I cache the entire collection of investments from the database on startup (currently 3,000 or so items), but I would prefer to not do that if it isn't necessary. The behavior that I am trying t...

How do I dynamically generate columns in a WPF DataGrid?

I am attempting to display the results of a query in a WPF datagrid. The ItemsSource type I am binding to is IEnumerable<dynamic>. As the fields returned are not determined until runtime I don't know the type of the data until the query is evaluated. Each "row" is returned as an ExpandoObject with dynamic properties representing the fiel...

How can I make elements arranged in a horizontal StackPanel share a common baseline for their text content?

Here's a trivial example of the problem I'm having: <StackPanel Orientation="Horizontal"> <Label>Foo</Label> <TextBox>Bar</TextBox> <ComboBox> <TextBlock>Baz</TextBlock> <TextBlock>Bat</TextBlock> </ComboBox> <TextBlock>Plugh</TextBlock> <TextBlock VerticalAlignment="Bottom">XYZZY</TextBlock> </St...

WPF binding in codebehind fails for transformations

Displaying a rectangle and binding Width, Height, Angle to a view model class works as I expect in XAML <Rectangle RenderTransformOrigin="0.5,0.5" Fill="Black" Width="{Binding Path=Width, Mode=TwoWay}" Height="{Binding Path=Height, Mode=TwoWay}"> <Rectangle.RenderTransform> <RotateTransform Angle="{Binding Path=Angle, ...

String animation in WPF?

How do I change the Content property of say a Button? Maybe with StringAnimationUsingKeyFrames? ...

WPF Setting style based on datatype?

Here's the problem. I'm binding a TreeView with a few different types of objects. Each object is a node, and SOME objects have a property called IsNodeExpanded, and of course, some others don't. Here's my style: <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsNodeExpanded, Mode=TwoWay}" /> ...

Define InputBindings in Style

I would like to add a right click and left click command to each listboxitem in a style. Is this possible? <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="InputBindings"> <Setter.Value> <MouseBinding Command="{x:Static View:Commands.AddItem}" MouseAction="LeftClick"/> <MouseBindin...

WPF Data Grid Example

I've been experimenting with WPF and just downloaded the toolkit which includes a DataGrid control. Does anyone know where I can find a fully worked through example of binding a database table to the WPF DataGrid? ...

What's wrong with my XAML?

I'm trying to get a simple data grid working under WPF, and I have no idea why it's not working. Here is the XAML - <Window x:Class="WpfApplication2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="333" Width="592"> <...

Create ToolTip on Silverlight DataGridTextColumn that is different from the bound cell contents

I have a DataGridTextColumn in a Silverlight 4 DataGrid and I want to set a ToolTip value on the column that is different from the bound value. I know I can do this with a templated column quite easily - but it adds a huge amount of extra XAML and makes it cumbersome to read and maintain. This works, but is a lot of extra code - especi...

What features of WPF are excluded in Silverlight 3 ?

Hi, What WPF features were removed from Silverlight 3 ? I have found resources on graphing algorithms in WPF and am wondering how much of that I can transfer to a Silverlight application. Thanks, Scott ...

WPF Control inside a transparent winform is not displayed

I create a simple WPF UserControl (any control will do) and insert it into a Winform (using an ElementHost). This works fine. The WPF control is embedded in the WinForm and when the WinForm is moved around the WPF control moves with it just like a WinForm control will do. When I change the WinForm to transparent by setting the Tranparenc...

WPF Toolkit: how to scroll datagrid to show selected item from code behind?

I tried following, all of following fails on function ScrollIntoView and gives NullReferenceException. // doesnt work grid.SelectedItem = sItem; grid.ScrollIntoView(sItem); // doesnt work grid.SelectedItem = sItem; grid.Focus(); grid.CurrentColumn = grid.Columns[0]; grid.UpdateLayout(); grid.ScrollIntoView(sItem,grid.Columns[0]); // d...

MVVM/Commands and ControlTemplates

Hi, I'm currently playing around with a MVVM/Commands and ControlTemplates. What I'm trying to do is quite simple. I want to have a list of e.g. Persons, where the user can trigger an action on each of them. But the event/commandhandler needs to be executed not on the person object e.g. because I want remove it from the list with a but...

How to save in Transaction?

Consider this scenario; suppose I have WPF window which have four objects bonded to its controls (Schedule, Customer, Contract, ScheduleDetails and Signer specifically ) which represent four database tables in the backend database. I want when the user request save for the information he/she entered to be joined in atom operation in anot...

TranslatePoint within a Canvas

I have a scroll viewer in my application that contains a canvas, in which I have a tree custom-drawn tree structure. I'm trying to get the position of a particular node element in the canvas relative to the scroll viewer (so I can scroll to it), but my attempts aren't working. I've tried using marker.TranslatePoint(new Point(0, 0), scro...

Microsoft Semblio

Has anyone used the Microsoft Semblio SDK to build a training or education product yet? If so, how was the developer experience and/or the user experience? ...

How do I tell my application to send an email?

How would I tell my application to send an email to a subscriber? How would I send it every week starting from the time the appication is launched. ...