wpf

WPF - example of creating XPS document that is NOT from Visual

I'm looking for a reporting/printing solution that does not involve RDLC/SSRS. I'd like to use the DocumentViewer, which I know supports XPS. I have found plenty of examples that use Visual to XPS but I haven't found many examples where I can take an existing WPF page, with various controls like labels, listboxes, grids, etc and create t...

WPF Animation - Why Can't "By" have a negitive value?

I am poking around the animation in WPF and I am confused. For RectAnimation, By cannot be negative for height and width. So, if you use the "By" keyword, rectangles can only grow (instead of "To")? Here is some example code: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsof...

MVVM ListBox controlling a Content Control

I've been going round in circles with this for a couple of days, and I'm hoping a WPF guru can see where I'm going wrong. I'm setting CurrentViewModel in code. The Selected item of my ListBox and the Content of my ContentControl bind correctly. But when changing the selected item in the Listbox via the UI the CurrentViewModel is being ...

Reusing a ContextMenu for multiple controls in WPF.

I have three tree view controls which house different (but mostly similar data), as a result the actions that can be taken at each level is the same as far as the user is concerned, but different in their type (which is something I have to worry about as the developer). What I would like to do is reuse this context menu and pass in a typ...

Experience with ValidationAspects for C# and WPF

I've downloaded the examples for the ValidationAspects library from CodePlex.com, but the samples flat out don't work. Nothing gets updated and changed to indicate errors on the forms in the samples. Has anybody had experience with the library ? Am I just missing something simple that I need to add / remove / reconfigure ? ...

WPF - cloning objects for an XPS document

Here's the bottom line: I'm trying to avoid using RDLC/SSRS and instead create XPS files from my XAML. I've combined pieces of code from various articles here and I am (1) cloning the XAML objects I need from my page and (2) passing those to a new page in an XPS object This process seems to work just fine with non data-bound objects th...

How can I set an image to the Image control in WPF?

I'm doing this: <Image Grid.Column="0" Grid.Row="0" x:Name="Andromeda" Source="/Resources/64px-Andromedahero.gif" /> But it's just not working. :S Here's a screenshot of the file/folder heirarchy. Any help? ...

How can I set an image for my BackgroundImage in my WPF Form?

In Windows Forms, I would go BackgroundImage and just select it from the comboBox. But here there is no such property. How would I go about this? ...

"Cannot convert string to ImageSource." How can I do this?

private void HeroMouseEnter(object sender, MouseEventArgs e) { ((Image)sender).Source = GetGlowingImage(((Image)sender).Name); } public ImageSource GetGlowingImage(string name) { switch (name) { case "Andromeda": return "HeroGlowIcons/64px-Andromeda.gif"; ...

CollectionViewSource in CodeBehind with Template Bindings

I'm creating a lookless control based on Selector in WPF with a Dependency Property named "ListItems". When SelectedItems is changed, I do: // CollectionViewSource ListItems = ... ListItems.Source = newSelectedItems; ListItems.Refresh(); And In my control template I bind it to a listbox like this: <ListBox ItemsSource="{TemplateBindi...

Expanding and collapsing in WPF

Hi, I want to create control like one in PDF file.In PDF,in left side pane we can see tabs like bookmark,signature etc., as image and we can expand it and collpase it.I want exactly like tht. As im new to WPF,i referred some samples and i created tabcontrol. Till now i achieved tabcontrols with image as Tab header. But i don know how t...

WPF WebBrowser Control .Net 3.5 SP1 and higher in XBAP application

Should I expect any problems with WebBrowser control, if WPF will be deployed as XBAP in a browser or it should work straightforwardly ? The reason I am asking this question is that WebBrowser control is added to Silverlight 4 , but works only in out of browser mode. I am primarily interested in HTML given to WebBrowser as a string ( ge...

How to find the point collection constituting a shape?

Hi I have created a simple ellipse in XAML like, Canvas Name="cnvMain" Ellipse Name="e1" Width="147" Height="89" Canvas.Left="64" Canvas.Top="89" Stroke="Black" /Ellipse Button Name="btn" Height="32" Width="65" Canvas.Left="102" Canvas.Top="197" Click="btn_Click" Cut /Button Canvas When I click this but...

PrevenHTML combobox(select element) dropdown to open

i have a WPF webbrowser application which loads the webpage containing a html listbox. On click of the listbox i want to open another wpf window instead of listbox own dropdown. However i am not able to prevent the html select own dropdown to open. i cannot remove the listbox from webpage because of backward compatibility constraints. Is...

WPF: Custom Theme for RibbonControlLibrary

I am using RibbonControlLibrary by Microsoft. It has three predefined themes and one can use them by <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Black.xaml"/> or <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml"/> or <ResourceDictionary Source="/RibbonControlsLibra...

Is there a way to persist user settings to a database in WPF

Hi, I'm exploring all the options to persist user settings. The artilce in the url http://stackoverflow.com/questions/803245/user-specific-settings-files-for-a-windows-form-application-local-xml-file-or-da convinced me to store the settings into a db as my application is a standalone communicating with a DB. Is there any provider class ...

wpf command custom control binding xaml

Hello there, i'm building a Videoplayer custom control (Project called WpfCustomControlLibrary1) and want to add a Load Command. This is what i have added in my class to get this Command: Public Class VideoPlayer Inherits Control ... Public Shared ReadOnly LoadCommad As RoutedUICommand .... Shared Sub New() 'This OverrideMetadata...

WPF: Select TreeViewItem broken past the root level

I'm trying to select a TreeViewItem by ID, but having problems getting it to work past the first (root) level. I've done so much reading round on this and am using the method below. private static bool SetSelected(ItemsControl parent, INestable itemToSelect) { if(parent == null || itemToSelect == null) { return false; }...

WPF Bind Textbox IsEnabled to Listbox SelectedItem

Hi everybody! Using MVVM style i succefully bound an ObservableCollection to a listbox, showing up the values as radiobuttons. The control behaves exactly as expected. Now i have an issue regarding some textboxes bound to this listbox: i want whenever the SelectedItem in the listbox is equal to a specific value (e.g. 'ValueForEnabled')...

Async function - callback using object owned by main thread

In my .NET application built with WPF and C# I call an async function using AsyncMethodCaller. In the callback I'd like to update some data in the GUI, but I'm not allowed to as this is owned by the main thread. How to I do it? Invoke an update on the main thread? How? Pass an object (e.g. ViewModel) as state to the callback and upda...