wpf

User Control Not Rendering When Used as a DataTemplate?

Hey folks, I have a usercontrol which I want to use as a DataTemplate in a Listbox. This works: <ListBox> <ListBox.ItemTemplate> <DataTemplate> <Grid x:Name="Grid" Height="100" Width="880" Background="LightGray"> <Grid.RowDefinitions> <RowDefinition Height="24"/> <RowDefinition Height="24"/> <Ro...

WPF Grid - Auto sized column not collapsing when content Visibility set to Visibility.Collapsed

I have the following simpl WPf grid, two columns, a button in each column, the first column auto sized and a splitter to allow column resizing. An event handler is set up on the splitter MouseDoubleclick event. When the splitter is doulble clicked the button in the left column is collapsed. Now, as column 1 is auto sized and the conten...

MS Surface drag & drop SurfaceListBoxItems

Hey guys I'm working on the Microsoft Surface Table and I'm attempting to drag an item from 1 SurfaceListBox to another and recognize which SurfaceListBoxItem the other SurfaceListBoxItem was dropped on top of. The SDK help as a great tutorial for dragging items from 1 SurfaceListBox to the next and just adding the content and removing ...

What is the best deployment approach for WPF applications with local database?

I want to make a WPF application that exists in one directory including all files that it needs: .exe, .mdf database, .xml config files, etc. the application should work no matter what directory it is in so that it supports this scenario: person 1 executes the application in c:\temp\wpftool.exe the application reads and writes to the c...

WPF INotifyPropertyChanged not updating on an array property?

I created a small example to demonstrate the issue I'm having. First my class: public class DisplayRow : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private int?[] values; private string title; public string Title { get { return title; } set { ...

Execute WPF Element validation in C#?

How can I force validation when user clicks button? One would think this should be easy, since always you have to do something if the element values are valid. private void buttonOk_Click(object sender, RoutedEventArgs e) { // How can I force the validation here? So that empty values are not allowed (validator doesn't allow those) ...

Is there a XAML/WPF/Silverlight style guide?

From .NET Rocks! Show #488: Richard Campbell: "In the GDI world we got a document from Microsoft that said you will build your apps in battleship gray and here's now they should look: File goes here and Help goes here, and we all got that as developers. There's no book like that for WPF. There was this idea I've got ...

Need themes for the WPF Toolkit controls (espeically DataGrid)

I just downloaded the nice themes collection from the Codeplex WPF Themes site. I like the WhisterBlue and BureauBlue themes a lot, but neither contain any styles for the new controls included in the WPF Toolkit (DataGrid, DatePicker, and Calendar). It seems like someone out there must have extended the themes to cover these controls, b...

Wpf Databinding and Converters

I'm trying to databind to a listbox like so: <ListBox x:Name="MyListBox" Margin="0,0,0,65"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource MyConverter}}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> The reason I am binding to the whole object and not a property is beca...

RichTextBox vs FlowDocumentScrollViewer - Why do they look so different?

I have a very simple xaml file where I am passing the same Paragraph and Run elements to both a RichTextBox and a FlowDocumentScrollViewer. The both look radically different - which is not what I was expecting. I understand that you can style either the FlowDocument or the containers so they look the same but I was expecting them both t...

Lines between nodes in WPF TreeView

All I want to know is if there's an easy way to add lines that connect nodes in a WPF TreeView, in the same manner as Visual Studio 2008's Solution Explorer pane. I found one solution but there's a lot of code and I want a simpler way. A thread on Microsoft's Silverlight forums seems to suggest that the lack of a "lines" option is due to...

Customized Content of TabItem WPF

I currently have a Custom TabItem which has a custom header, which is defined as part of a style like this <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type t:TwitterListTabItem}"> <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{Template...

WPF Paged CollectionViewSource

I have a WPF ListBox that I would like to add pagination to as it starts getting slow with a bunch of items. My problem is that I use the Grouping, Sorting, and Filtering. That means if I were to limit the data with the LINQ Skip() and Take() methods or using something like a paginated ObservableCollection the grouping and sorting would ...

Wpf: Inherit code-behind Code

Hi, I have several similar user controls which display listviews of respectively different data entities. In the code-behind files of these controls there is quite a bit of common business logic. How can these common methods be combined in a single "super-class" as I would do in a normal non-wpf-case (reusing any xaml parts isnt necess...

Command in a WPFToolkit DataGridTemplateColumn not working

im using the WPFToolkit's DataGrid and im trying to get an edit button working, here is the column: <my:DataGridTemplateColumn> <my:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock> <Hyperlink Command="{Binding EditVen...

How to use the GDI+ drawing in WPF?

I want to use the GDI+ drawing in my WPF control. ...

TreeView bound to XMLDataProvider - shows data in editor, but empty when run

I have bound a TreeView to an XMLDataProvider. The TreeView displays the data as expected in the Visual Studio editor. But when I press F5, the application runs but the treeview is blank. Does anyone know why I can't see it when I run the application? Here's the entire code: <Window x:Class="TreeViewDataBinding.Window1" xmlns="htt...

WPF Renders diffrent on xp vs Windows 7.

Well the title says it all im using .net sp1 on both computers.. My layout is like this window that has no toolbar and is set to maximize so it fits the hole screen. Under that i have a Viewbox set to use Stretch: Uniform, and under that i have my LayoutRoot. This way i hoped to get the same layout on all computers but it seems it doe...

How to bind a ComboBox to generic dictionary via ObjectDataProvider

I want to fill a ComboBox with key/value data in code behind, I have this: XAML: <Window x:Class="TestCombo234.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:TestCombo234" Title="Window1" Height="300" Width="300...

WPF ComboBox SelectedItem not Updating

I am facing a problem while working with a WPF ComboBox. My situation is that I have a ComboBox that is displaying some values. I am adding ContentControls to ComboBox' Items property. I have bound the Content of these ContentControl to some datasource so that I can change the Content dynamically. The problem is if the Content of item wh...