wpf

What's the best way to auto-scroll a list view to the last added item?

I use a ListView to show a list of errors as they occur in my application. It behaves and looks exactly like the Error List in Visual Studio. I want to add auto-scrolling when the last error item is selected (like how Visual Studio's Log Window auto-scrolls when you place the caret at the end). The list of errors is in an ObservableColl...

How to specify a ToolTip for a control in a Style from XAML?

I'm using a the WPF datagrid from the Microsoft CodePlex project. I have a custom control that I want to databind to a field from the row of the datagrid. I can't for the life of me figure out how to specify a tooltip on a datagrid row. The closest I've come is to use a RowStyle with a Setter to set the tooltip, but this only seems to ...

WPF: Collision Detection between 2 ModelVisual3Ds

Hi, I would like to know when a ModelVisual3D has overlapped another ModelVisual3D (I am uncertain as if they are in the same Viewport3D or not). The models are in XAML form. I have searched and searched for a solution without success. ANY help would be appreciated. Thanks Q PS I am working with VB.NET - but will accept C# code. Th...

What are the pros and cons of these client options in C#? winforms, WPF, Jquery, ASP.NET AJAX, and Silverlight

just wanted to clarify the options for client presentation : 1) winforms - for windows client - older technology 2) wpf - for windows client - newer technology, uses xaml 3) jquery - for web client - uses javascript 4) asp.net ajax - for web client - older technology 5) silverlight - for web client - new...

How to keep relative position of WPF elements on background image

Hi folks, I am new to WPF, so the answer to the following question might be obvious, however it isn't to me. I need to display an image where users can set markers on (As an example: You might want to mark a person's face on a photograph with a rectangle), however the markers need to keep their relative position when scaling the image. ...

What is the advantage of Properties Triggers over Data Triggers in WPF

I try to understand the advantage of Properties Triggers over Data Triggers in WPF. It seems that Properties Triggers can be triggered only by a value that changed in dependency property, and Data Triggers can be triggered both by a value that changed in dependency property, and a value that changed in a .Net object that implement INotif...

DataBinding fails for a collection property of custom control

I have a user control - say "ControlBase". It has "SomeItems" property, which is an ObservableCollection<InheritedFromDO>, where InheritedFromDO is a class inherited from "DependencyObject". When I create markup for a child class of the ControlBase i'd like to initiate the "SomeItems" collection. But somehow I cannot use bindings in that...

How to build a new VS2008 WPF solution/project when you've lost the .sln and .csproj files?

I have an old VS2008 solution that had one project in it. When I double-click on the .sln file it says that nothing can be found (I had renamed some directories). So now what is the best way to take my main files (Window1.xaml, App.xaml, Properties folder, and about 10 other class files) and recreate a solution and project for these ma...

WPF focus textbox after Window is restored/activated from minimized state

Hello, I have a simple WPF application where user is able to minimize my application window. After user restores Window from minimized state I need to set focus to certain TextBox. If user before minimizing Window has not changed focus, then after restoring application everything is fine. But problem comes when user has changed focu...

Padding in a list box

In my application, I defined a DataTemplate for a listbox to be a grid with a stretched border, with a label inside it. For some reason, I've got the following result: As you can see, there is a padding between the listbox border, and the item border, and this "padding" is marked when the item is selected. What property should I chang...

Update field when property changes

This is probably a basic question, since I'm new to WPF.. I have a UserControl that contains a TextBox and a Button (code is simplified for this question) : <UserControl x:Name="this"> <TextBox Text="{Binding ElementName=this, Path=MyProperty.Value}"/> <Button x:Name="MyButton" Click="Button_Click"/> </UserControl> In the cod...

Multiple storyboards on one property

I have multiple storyboards that access the same property (not at the same time). After one storyboard changed the property, the other one seems to have no access to it and does not change anything.. What can I do against this? Sample: <ListBox> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Sett...

In WPF, what is the best way to create a calendar view similar to Outlook 2007?

I'm writing a WPF desktop application and have a view that needs to look like a calendar. I only need to show four weeks (fixed). Each week will have a list of items (probably represented with a ListView). I'm debating between two approaches: Using layout controls - a Grid control where each "cell" contains a ListView Using a ListVi...

In WPF, how do I select the treeview item under my cursor on right-click?

In WPF, when I right-click on a treeview item I would like it to be Selected/Activated before showing the context menu. This sounds pretty simple, but the inclusion of a hierachicalDataTemplate complicates things a little. I have the following treeview: <TreeView x:Name="trv" ContextMenu="{StaticResource conte...

How achieve Image.Clone() in WPF?

Hi there, I obtain an array of byte (byte[]) from db and render into a Image Control using the following method : public Image BinaryImageFromByteConverter(byte[] valueImage) { Image img = new Image(); byte[] bytes = valueImage as byte[]; MemoryStream stream = new MemoryStream(bytes); BitmapImage ...

How do I print from the wpf WebBrowser available in .net 3.5 SP1?

Hi, we are currently using a winforms WebBrowser control in our app in a WindowsFormsHost and printing by calling 'WebBrowser.ShowPrintDialog()' We have an issue with this in that the dialog does not appear to be modal and the parent window can be dismissed causing issues if a print is later attempted. I was looking at the new wpf webb...

WPF Listbox highlight part of ListBoxItem element

Hello, I have a TextBox and ListBox. User can search ListBox elements from TextBox. ListBox is bound to CollectionViewSource. CollectionViewSource has Filter event handler, that filters elements based on text that user enters into TextBox. My requirement is to highlight user entered text within TextBlock of ListBoxItem elements. I ...

wpf snippets

Not the visual studio integrated kind, the snipplr, dzone snippets, etc. kind. I went to a few of these sites and didn't see anything for WPF. I was thinking of posting a few I like somewhere, and was hoping to find a site that already had some. Recommendations? So far I'm liking the dzone functionality. ...

WPF MVVM Correct way to fire event on view from ViewModel

Hello, In my WPF application I have 2 Windows (both Windows have their own ViewModel): Application's Main Window that displays list with bunch of words (bound to MainViewModel) Dialog Window that allows users add new items to the list (bound to AddWordViewModel) MainViewModel has Articles property of List(this collection is populat...

WPF - Translucent application

My goal: Similarly the Intellisense dropdown in Visual Studio 2008, when the user presses CTRL, I want the entire application to become 40% opaque. How can I do that? I want to use the regular window chrome, so my WindowStyle cannot be "None". Thanks! ...