wpf

Apply Office 2007 themes for WPF application.

I am using the RibbonControl from WPF toolkit. It has the Office Blue, Black and Silver themes. But the the theme is not applying for the controls in the window. Is there any solution for that? I am aplying the theme like <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/RibbonControlsLibrary;component/Theme...

How to say XAML <Button Height="Auto"/> in code behind?

How can you set Height="*" and Height="Auto" in code behind? ...

wpf custom control not recognized

This is my first foray into custom controls, and it's not going well. I have a custom graph control derived from Canvas. namespace Grapher2 { public class SeriesManager : Canvas { public SeriesManager() { ... } } } It's defined in the same project and namespace as my app. I tried adding a reference to the c...

Style first row in a WPF Datagrid

Hi, I would like to change the styling of the first row (only) in a WPF Datagrid but haven't found how to do it. I wondered about creating a trigger, something like this: <Style TargetType="{x:Type dg:DataGridRow}"> <Style.Triggers> <Trigger Property="SelectedIndex" Value="0"> <Setter Property="Background" Value...

WPF - GridView.GridViewColumn two lines per row?

Hello is it possible to have a ListView -> ListView.View -> GridView -> GridViewColumn with "two rows" per row. eg.             COLUMN 1 | COLUMN 2 ROW 1 blah          | data             blah ROW 2 etc            | more I have tried unsuccessfully to use a Cell template but the item inside the template doesn't resize when its ...

Why can you inherit a class over project boundaries, but not its attached XAML?

(this question is a refinement of my other question on this topic which was a bit complicated but I really want to understand why this doesn't work so here's a more straight-forward example) WHAT I WANT TO DO: create a simple class (no XAML) in one project which inherits a WPF UserControl (with XAML) in another project. Here is my inhe...

How to add text to a inkcanvas with code ?

Hi I would like to add some text (like a label) on a InkCanvas with WPF in C# code (not Xaml). How is it possible ? thanks Jonathan ...

Reusing a TreeView's expand [+] and collapse [-] buttons in WPF

Is there a way to reuse the simple expand [+] and collapse [-] buttons that appear next to nodes in a WPF TreeView? I would like to have a similar graphic elsewhere in my application for expanding and collapsing some controls. ...

WPF/XAML - hide image if another control's text property is empty/not set

hello everybody, i'm new to wpf and this is my first attempt of creating a custom user control. its purpose is to display two values (myText1 and myText2) with their corresponding images (myimage1, myimage2). sometimes, one of these values is not set and therefore oneimage should be hidden as well. here's my code so far: Window1.xaml ...

General way of setting element bounds

Hello There, I'm writing an application which is basically a designer very similar like Expression Blend or Visual Studio designer. So basically there are a bunch of UI elements on a design surface and you can do things such as drag'n'drop, resize, rotate, etc. The main container control, which will be the designsurface can be any cont...

WPF Window.Close() not triggering UserControl.Unloaded event

I have a Window that contains a custom UserControl. The UserControl needs to know when the Window containing it has been closed so that it can terminate a thread. My best guess as to how to accomplish this is to handle the UserControl's Unloaded event. However, the Unloaded event only seems to be firing when the user actually clicks t...

wpf databinding - two way binding with a string?

I have a simple property on my view model that is of type string. I want to bind this to a textbox so that changing the textbox updates the string and changing the string updates the textbox. Do I REALLY have a write a wrapper class around the string type that implements INotifyPropertyChanged, or am I missing something incredibly simple...

Any WPF Gauge Controls that are open source?

I need to find an open source WPF Gauge Control that I can use in my Rich Client (not for silverlight). Does anyone have any recommendations on one that is open source? I need to build a WPF dashboard and the client is requesting using Gauges to display data. ...

How to make a piece of WPF content take up the entire application window

I'm working on an application that contains a number of content areas. I want to implement a behavior such that in response to user input, any of these content areas can be toggled to fit the entire application window, and optionally back to its original position again. I experimented with several approaches and none of them seem optim...

Is there a Visual Studio (or freeware) equivalent for Expression Blend's "Edit Template" feature?

In Expression Blend, you can view and edit the control template of objects in the "Objects and Timeline" panel. I'm wondering if there's an equivalent feature in Visual Studio or if there's something free (or very inexpensive) I can download that will allow me to do this. Here's a screen cap from Expression Blend that shows what I'm tal...

Can somone give example of Dependency Property in ViewModel

Can somone give example of Dependency Property in ViewModel in WPF passed as datacontext to view. Will this require inheriting from DependencyObject? Lets say I want ListBox SelectedItem bound to a Dependency Property CurrentItem in ViewModel. I have it working from window object but same thing donnt work with ViewModel . In ViewMode...

GridView dynamic column width in WPF

<Window x:Class="GridViewSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" > <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <ListView Name="CheckoutList" Margin="0,0,8,0"> <ListView.View> ...

How can I add a UIElement to a Windows Forms application?

I have a WPF custom control I'd like to add to a Windows Forms application. So I added a reference to the WPF assembly, created an ElementHost and set the Child property in code. Is there a way to do this with drag and drop i e without writing code? I have tried the ElementHost popup but it does not list my component. As far as I can see...

WPF binding: How to suppress validation when nothing is entered

I use WPF data binding with entities that implement IDataErrorInfo interface. In general my code looks like this: Business entity: public class Person : IDataErrorInfo { public string Name { get; set;} string IDataErrorInfo.this[string columnName] { if (columnName=="Name" && string.IsNullOrEmpty(Name)) return "Name is...

wpf user control base class problem

I am new to WPF and have created a WPF User Control Library I added a Base class that looks like this public class TControl : UserControl { } and want all of my controls to inherit from it. I have a Control called Notification which looks like public partial class Notification : TControl { public Notification() { In...