wpf

WPF: complex tab focus behavior

Guys, What's up :-) Need your help. My control is constructed from nested list boxes and tree views. Each list box / tree view item also contains rich text boxes and other controls. I want to define a 'tab' focus behavior such that when the user clicks 'Tab' the next focusable item (according to an order i define) will become focused...

VisualCollection and ContentPropertyAttribute in XAML

Hello, I want to write a custom FrameworkElement which host Visuals. My first attempt was to create an instance of ContainerVisual and write a wrapper property for ContainerVisual.Children and then set it as ContentProperty so I can and Visuals via XAML. But VisualCollection does only implement ICollection and not IList or any supported...

How to remove items from list x seconds after adding them

Hi. I need to remove items from list few seconds after i added them. I have now an ObservableCollection to which I add some messages. I need them to be deleted let's say 5 seconds after they were added. I tried to create a function responsible for adding the items and setting a timer: public void AddInfoItem(string info) { ...

Issue with scrollviewer and canvas

I have a custom canvas control which sits inside a scrollviewer - I have implemented drag, drop and move for items on the canvas and overridden MeasureOverride so that when I move an item around on the canvas its size reflects the changes so if I move the item beyond the visible portion of the canvas it will resize to accomodate the move...

how we set the path of image in datagrid item template image column(Wpf Data Grid)

hello All i have a problem i have a Wpf data grid which have three item template image column i want to set the image source through cought behind how can i achive it i m unable to fetch my image inside column my xaml code of grid is inside plz help me` <my:DataGrid.Columns> <my:D...

Order of execution in a WPF Textbox

I'm running into an issue with a formatting converter and data validation. I have the following textbox XAML declaration <TextBox FontFamily="Segoe" FontSize="16" FontWeight="Medium" TabIndex="{Binding TabBinding}" Foreground="Black" Opacity="0.9" IsTabStop="True" Uid="{Binding PriceID}" Text="{Binding NewPrice,Converter={S...

How can I force a textbox change to enable my command in WPF?

I've got a textbox in a WPF window that's bound to a string proprty in my ViewModel. I also have a button that is bound to a command. The button is the default button in the window so that when enter is pressed, the command runs. The command is only enabled when the textbox is not empty. If I type into the textbox, then hit enter, all w...

run all modules of a catalog (prism)

hello, i'm using the desktop library of prism. what i want is to get modules in a directory and then, run them. I do like that: DirectoryModuleCatalog catalog = new DirectoryModuleCatalog(); catalog.ModulePath = @"C:\Users\Raph\Documents\Visual Studio 2010\Projects\LibraryLoad\LibraryLoad\Modules"; I checked, the modules are loaded ...

Binding with ValidatesOnException throws Unhandled-Error in .Net4

I encountered a very annoying change for me from .NET3.5 to .NET4.0. When using a ExceptionValidationRule on a binding for validating the exception thrown in the bound properties setter gets handled by the binding in 3.5. In 4.0 it is thrown as unhandled while debugging. Changing the target framework from 3.5->4.0 in this small example ...

Problem animating a WPF button

I have a button, this is a unique button, and his style should çn't match the style of all the others. So when you pass your mouse over this button, it should change its image. But it is not working, Here is the code... I'm starting at WPF so if you can point me what am I doing wrong would be really appreciated <Button Name="RemoveButto...

UIElement.PreviewMouseMove or not MouseMove... that is the question

WPF, MSDN: UIElement.PreviewMouseMove Event Occurs when the mouse pointer moves while the mouse pointer is over this element. As I can see, this is not true... When I PreviewMouseDown, then PreviewMouseUp, an PreviewMouseMove event interferes. Is this a bug in Framework or MSDN documentation leak? I just need to differen...

MS Ribbon for WPF - How can I change the skin

Hi All, I'm using the latest version of MS Ribbon for WPF (3.5.40729.1). Downloaded from: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2BFC3187-74AA-4154-A670-76EF8BC2A0B4&amp;displaylang=en and want to change the skin of ribbon. How can I change the skin ? Is microsoft planning to provide any skins in the next release? ...

Converting Java GUI to C# WPF

New to C# and WPF trying to reproduce a simple 2D chess game written in Java Swing a few years ago. Consists of an 8x8 grid of buttons, produced in a loop similar to: JButton[][] squares = new JButton[8][8]; grid.setLayout(new GridLayout(8,8)); for (int i = 0; i < squares.length; i++){ for (int j = 0; j < squares[i].length; j++){ sq...

horizontally center vertically maximized WPF window

I have a WPF window that has a MaxWidth set, so when I hit the Maximize button, it maximizes vertically but not horizontally. This is expected behavior. However, the window always docks to the left side of the screen (Windows 7, if that matters) and I want it to be centered horizontally when Maximized. I tried adding the following Sta...

Capture Screen at ScreenSaver startup

Hey All, I am creating a WPF screensaver, although this question isn't really WPF-specific. I have code to do a screen capture when the screensaver kicks in (using GDI+ and Interop). This all works fine in Preview mode, but not in normal screensaver mode (even though both call the same code). I'm guessing that Windows itself is cle...

WPF loading animation on a separate UI thread? (C#)

Okay, I have a loading animation that runs while a large DataTable is populated to let the user know that the program has not frozen. I have the animation working fine, but it freezes while the DataTable is updatingv as well. Is there some way to have multiple UI threads, so that the animation will continue to run while the DataTable is ...

Why doesn't the SourceUpdated event trigger for my Image Control in WPF?

I have an image control on a Window in my WPF project XAML: <Image Source="{Binding NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}" Binding.SourceUpdated="bgMovie_SourceUpdated" Binding.TargetUpdated="bgMovie_TargetUpdated" /> In code I am changing the source of the image C#: myImage = new BitmapImage(); myImage.B...

WPF Listbox with images - how to detect if an image didn't download

I have a wpf ListBox, and each item has an image that the list needs to download from a server - the list definition looks like so: <ListBox x:Name="List" BorderThickness="0" AlternationCount="2" ItemContainerStyle="{StaticResource alternatingWithBinding}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisib...

Print documents via Wpf-controls and convert to XPS.

I'm trying to convert XAML control to XPS document, but i'd like to do this in batch mode - render control in memory and print it to XPS without rendering it on the screen. This project should work even without GUI. I've read Related topic on stackoverflow, but it's not working properly. I can create control, set DataContext, but output...

MVVM window/region handling

Two questions here. My view has a "close" button that when clicked, the window should close. I handled this as follows: The button in my view binds to a command defined in the view's view model, which when triggered runs the following: private void Exit() { var regionManager = Container.Resolve<IRegionManager>(); M...