wpf

Triggering on a ScrollViewer's scroll bar visibility (WPF)

Is it possible to create a Trigger that is triggered based on a ScrollViewer's scroll bar visibility? I have a ScrollViewer with its VerticalScrollBarVisibility set to Auto and I want to change some of the ScrollViewer's properties only when the scroll bar is actually visible. Something like this: <ScrollViewer VerticalScrollBarVisibil...

WPF in a browser and printing

Can WPF be hosted in a web browser? If so how? (I think it can as I have seen some examples of it.) While hosted in the web browser what printing support does it have? What are the drawbacks to using WPF in a browser? My company is looking for a rich web app platform. They will not choose Silverlight because it ignores any printing...

Disappearing circles

I discovered that even numbers of overlapping shapes added to canvas like that: GeometryGroup gg = new GeometryGroup(); EllipseGeometry e1 = new EllipseGeometry(new Point(10, 10), 20, 20); EllipseGeometry e2 = new EllipseGeometry(new Point(10, 10), 20, 20); //EllipseGeometry e3 = new EllipseGeometry(new Point(10, 10), 20, 20); gg.Chi...

WPF ContextMenu with ItemsSource - how to bind to Command in each item?

Hi, I have a collection of objects (viewmodels) that represent menu items. Each of them have a command that I would like to execute when a MenuItem is clicked. If I wanted to do the menu statically, I do it like this: <ContextMenu> <MenuItem Header="{Binding Text1}" Command={Binding Command1}> <MenuItem Header="{Binding Text2}"...

How to add a ContextMenu depending on which WPF DataGrid row is right-clicked?

I need to display different options in a ContextMenu depending on which row of a WPF DataGrid is right-clicked. My initial ideas were to accomplish this through either binding or handling a mouse click event, but I haven't had success with either strategy so far. Any help would be most appreciated! Thank you! Denise ...

How to implement DataTable property with INotifyPropertyChanged

I have created WPF MVVM application, and set WPFToolkit DataGrid binding to DataTable so I want to know how to implement DataTable property to notify changed. Currently my code is like below. public DataTable Test { get { return this.testTable; } set { ... ... base.OnPropertyChanged("Test"); } }...

Have a databound WPF Listbox generate subclassed ListboxItems

I would like to have my WPF Listbox, which is databound, generate subclassed ListboxItems instead of the regular ListboxItems. In this case, a DataTemplate is not sufficient because I need some custom properties for the subclassed ListBoxItems. Is there a way to have the ListBox generated mySubClassedListBoxItem items for the bound data...

How to specify a browser to use for debugging in Visual C# 2008 Express?

With recent events with vulnerability found in WPF browser plugin and Firefox forcing a block on it, I can't seem to find a setting in Visual C# 2008 Express Edition that would allow me to run/debug my XBAP project in Internet Explorer without having to switch my default browser to IE. Am I missing something here? ...

WPF TextBox - programatically select text while preserving "selection direction"

When editing text the user is able to use the keybord shift button and direction keys to modify the selection - one position stays anchored while the other moves. By pressing left it is possible to get the movable part on the left of the anchored part. I'm trying to dinamicaly modify the users selection in WPF's TextBox (for the purpose...

StackPanel draws artifacts between each child control

hi, i'm trying to draw a rectangle with semi-circles at either end. i'm also trying to split the rectangle where the left half is a different colour to that of the right half. i've managed to do this using a stack panel and CombinedGeometry, as in the example below. however, the code below draws a line inbetween each control within the s...

[C#/ WPF] Adjusting TabItem width automatically to fill spaces?

I have a TabControl object with some TabItem objects inside. Now the sum of width of TabItem is not long enough to fill the space on right: Now I wish to have one of following design: What properties should I set to archieve one of the design above? For the second design, I tried to adjust HorizontalAlignment property (to "center") i...

The mysteries of extending the WPF animation classes

Silverlight has a property on its animation timelines (like DoubleAnimation) called EasingFunction which allows you to specify a function with which to interpolate two values. Even though it's coming in .NET 4, I'd like to port this to 3.5. After reading this, it seems pretty doable, but I'm having a weird issue. I'm extending DoubleAni...

WPF, xaml Cad or drawing app examples?

I am trying to learn WPF and xaml and am writing a cad style geometry app for my kids. Does anyone know of an existing example written in VB.net? C# is fine as well. Thanks! EDIT: Any thoughts/examples on how to structure such an app? TIA ...

Update UI by code in WPF

Hi, I'm trying to update some user control in wpf by code, with no luck. That's the xaml: <UserControl x:Class="SimuladorNocs.UI.Diagram.PropertiesWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:PropertyGrid="clr-namespace:Deepforest.WPF.Controls" >...

WPF - How to right align a textblock inside a horizontally oriented stackpanel?

This should be so simple - I've been hitting my head against my desk for so long trying to make a seemlingly simple task work (makes me feel like WPF is un-intuitive or buggy)... In any case, I've got a Stackpanel which is set to horizontal orientation. Inside it I've got two TextBlocks. I want the 2nd one to display it's text to the r...

wpf / silverlight textbox filter design

I have a list that the user can filter in several ways. two of which lend themselves to combo boxes and two that need to accept user input. For example, one textbox allows the user to type in any part of a list item's description, and the dialog will only present items whose description contains the text entered. It is a dialog 'picker'...

ComboBoxItem to full width of ComboBox, when using SelectedIndex, or navigating keyboard?

Following XAML causes the "My stuff" being centered of ComboBox until I open the ComboBox, when it correctly stretches itself. <ComboBox Height="30" Width="300" HorizontalContentAlignment="Stretch" SelectedIndex="0"> <ComboBoxItem HorizontalContentAlignment="Stretch"> <Border Background="Red"> <Te...

Nested grouping in ListView

Is it possible to define few groups in one ListView? I mean group inside group, it is like tree. If yes - any link to sample, tutorials. ...

Using SetWindowTheme() on controls in WindowsFormsHost in WPF?

I have an application I'm developing which closely mirrors Windows 7's Device Stage. In Device Stage, beneath the main banner there is a ListView containing actions embodied as ListViewItems. In my WPF application, I used WindowsFormsHost to host a WinForms ListView so that I could use SetWindowTheme() on it and apply Windows Vista/7 st...

Are there any algorithms for efficient allocation and usage of UI threads for use with WPF?

WPF utilizes a single thread to dispatch events via the windows event pump. When each control is created, it is associated with a thread and consequently all activities associated with that control need to occur on that thread. We've got an application that has a large number of top-level windows, each with a host of controls within th...