wpf

WPF: can a DoubleAnimation be applied to any double, or just a dependancy property?

Hi all! Can DoubleAnimations be applied to any double? Or just some? In WPF, I know you can create a DoubleAnimation object: var ani = new DoubleAnimation(); ..and that object can be used in the BeginAnimation method of UIElements. In my case, however, I'd like to just apply the animation to the object the the UIElement is bound t...

How to Uncheck ICC profile for image in wpf to remove reddish tint in the image

I have developed a WPF Application for saving images by using Canvas.After saving the image iam getting some reddish tint on those saved images.I googled for the solution but i didnt got any solution for that. After long time i came to know that in Adobe Photoshop some IccProfiler is there.If we uncheck that we can retrieve the original ...

Best practice for parent/child-viewmodel-relationships in MVVM using Onyx?

Hy guys! I am currently working on a little WPF project using MVVM via the Onyx framework. My currentview architecture is like this: <DockPanel> <Menu DockPanel.Dock="Top" Background="#cecece"> <!-- Menu --> </Menu> <Grid> <views:TranslationView x:Name="translationView" /> </Grid> </DockPanel> ...

How to determine the default printer using WPF?

To retrieve the list of printers I use: new LocalPrintServer().GetPrintQueues(new[] { EnumeratedPrintQueueTypes.Local, EnumeratedPrintQueueTypes.Connections }) How do I determine, which of the printers is the default printer? Note: the System.Printing.dll assembly is used. ...

Creating new windows in a WPF application

I'm writing a WPF application which will monitor a feed. When there are new items determined from the feed I want to spawn off small windows as a notification. If anyone's familiar with Growl on OS X, that kind of what I'm trying to do. Also, I'll point out that this is my first WPF application (and the first time I've done something tha...

WPF Drag-to-scroll doesn't work correctly.

Hi all, I am tying to realize a drag-to-scroll functionality in my application and have problems on my way. Can anybody help me? I have a ScrollViewer and inside it an ItemsControl and within ItemsTemplate I have a UserControl. I want to drag that UserControl within ItemsControl. I want the ScrollViewer to scroll down, when I am dragging...

Binding Commands to Events?

Hi, What's a good method to bind Commands to Events? In my WPF app, there are events that I'd like to capture and process by my ViewModel but I'm not sure how. Things like losing focus, mouseover, mousemove, etc. Since I'm trying to adhere to the MVVM pattern, I'm wondering if there's a pure XAML solution. Thanks! ...

9-Slice Images in WPF

I was wondering if anyone knew how to duplicate the 9-slice functionality of Flex/Flash in WPF and VB.Net. I have used 9-slice scaling many times in Flex and it would be a great asset in WPF. I would like to be able to have an image as my background of a Canvas and have it stretch without ruining the rounded corners. Please, does anyone ...

Display printer-specific configuration dialog

Having a PrintTicket how to display the printer-specific configuration dialog? Note: I don't mean the PrintDialog from the System.Windows.Controls namespace. ...

WPF ListBox with only Button for ItemTemplate

Hi, I am binding a list of items to a ListBox, I need some help with XAML to be able to display a button for each item. I can display a button fine, however the button takes on the length of the content text. I want my button to consume 100% of the ListBox width. I also need to stop the row highlighting for the ListBox, as the button ...

WPF searchbox and databinding to treeview

I'm trying to implement a real-time updating search bar which updates a TreeView when search phrase changes, however I don't quite manage to get it to update the way I want. All the items are present in the treeview at application startup (it only contains one level of children at the moment). The SearchPhrase property is also updating ...

WPF animation first run

I have a simple WPF application that contains a user control that is animated in and out by a pair of storyboards on the main window. I am animating the user control's opacity, scaletransform.scalex and scaletransform.scaley to pop it in and out of view. It looks cool except for the first time it runs. The animation is set to take 3/1...

WPF Databinding based on conditions

Goal Develop a custom control which displays summary data for a specified week. The data passed in would be as follows: 3rd May 2009 Customer A $2000 4th May 2009 Customer A $3900 6th May 2009 Customer B $1900 The expected display would be 3rd May 4th May 5th May 6th May Cu...

How to select TreeView item from code

I have a three level treeview. How do I select any item in third level from code? I tried a method mentioned in many blogs and on stackoverflow but it seems to work only for first level (dbObject is null for items on below first level). Here is the code I'm using to select TreeViewItem. Do I miss something? public static void SetSele...

Changing "active content" security settings on WPF WebBrowser control

I'm putting together a WPF application that will allow users to view PowerPoint files through the WebBrowser control, once the files have been saved as either .MHT or .HTML. The problem is that the files contain ActiveX controls, and the WebBrowser control by default will display a warning every time I load these files, saying "To help p...

wpf image resources and changing image in wpf control at runtime

I would like to know exactly how to dynamically use a Dictionary Resource in the C# code behind - ie.. I would like to load images at runtime from an image resource within a dictionary I have a program that has 3 images in a WPF Dictionary - these are images set as image resources. Then in the code behind of my WPF Window I want to loa...

WPF - inherit from System.Windows.Application

I would like to have my own application class that inherits from System.Windows.Application. The problem is that in the Application.xaml file, I have to declare the app like this : <src:MyBaseApplication x:Class="MyApplication" xmlns:src="clr-namespace:MyApplication;assembly=WpfTestApplication" xmlns="http://schemas.microso...

Accessing ResourceDictionary from WPF UserControl

I'm trying to access a resource dictionary in a UserControl code-behind via C# and I'm having little success. Merged Dictionary: <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Resources/BiometricDictionary.xaml" /> </Resou...

Viewbox behavior that I cannot understand

I have a DataTemplate that's used as a logo to describe a Version object. The logo is simply an image and some text on top of it. I have to use the DataTemplate in 2 places: - As the Content of a Button - As a thumbnail item of a ListBox The thing is, the logo has to be much smaller in the ListBox than in the Button. This doesn't cause...

WPF button content template

I want the content of a wpf button to be left aligned I tried the following but the text is still centered inside the button. <Button > <StackPanel HorizontalAlignment="Stretch"> <TextBlock HorizontalAlignment="Left" Text="Save"/> </StackPanel> </Button> What do i do? ...