wpf

Problem assigning source property to Image Control WPF

I have a WPF C# project that I am working on and I have multiple (25) Image controls arranged in table (5 columns, 5 rows). Each Image control is called "Image[row][column]" (eg:Image15). Assigning a different source to the control works fine with ony one problem. No matter which control I use (Image11, Image12, Image 55) it affects Ima...

Handle Database Transactions & Exceptions in TreeView with Multi-Tier MVVM

Hello: Background: I have a custom user control based around a WPF TreeView. I've been using the MVVM pattern and have a base view model TreeNode class and several derived view models such as LocationNode, LocationFolder, PersonNode, PersonFolder, CollectionNode, CollectionFolder, etc.. A example of how the tree might be laid out is: ...

wpf set sorting programmatically, so that the header is toggled as sorted

I have a problem in wpf toolkit datagrid. I have a Itemsource whit three columns: FirstName LastName Address in C# Codebehind i set the sort direction and wich column to sort on like this: ICollectionView view = CollectionViewSource.GetDefaultView(dataGrid1.ItemsSource); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new S...

Interacting with two UI threads using different windows

My application is using an image processing library to handle a long running task. The main UI with settings and controls is implemented in WPF. The image processing needs to be displayed and the main UI needs to remain responsive. Upon clicking the 'process' button in the main UI a new thread is spawned which creates a new WinForm windo...

How to modify select parts of default chart style?

I have a LineSeries that I am trying to build from the code rather than the XAML. I am using a LineSeries, but I want to remove the markers, and just have the line. To do this, I've changed the style so that the hight and width are zero: //modify series style var lineStyle = new Style(typeof(DataPoint),bChart.Style); lineStyle.Sette...

MVVM and DI - How to handle Model objects?

I'm using Caliburn and C#, but I feel like this is a generic MVVM/DI question. Let's say I have a view model, NoteViewModel, that is passed a model object called Note. Here is some code: class NoteViewModel : PropertyChangedBase { private readonly Note _note; public NoteViewModel(Note note) { _note = note; } public str...

TreeView in wpf ... Is there a SelectedItemChanging event?

Hi all I am making use of a System.Windows.Controls.TreeView in a wpf application. Basically I need the equivalent of a SelectedItemChanging event so that I can cancel the the selection event of the treeview. Is there a way to do this? I was not able to find something called SelectedItemschanging event on a treeview. Thanks! ...

Animation in WPF query

I'm playing with WPF for the first time in an animation/graphics context, and I am wondering how you'd move sprites around. I googled and came up with this example, but the animation is done by increasing/decreasing the margins and padding. My question is, is this normal? I would have thought you'd do animation by changing the x and y c...

How to bind a WPF control value to a method?

Imagine I have a TextBox that it's Text should be equal to the number of running processes in the machine. How to make it to update without using timers? Is there a way using Dependency Property or Bindings? ...

Only Search for Text Within XAML Files using Visual Studio 2010

Many times I find that I want to search my entire Visual Studio project for a text string, but I only want to search the XAML files in the project and not the code-behind (.cs) files. Does anyone know if there is a way to do this in Visual Studio or if there is an add-in I can download to accomplish this? Thanks. ...

WPF: looking for list of each control's states and brushes

Is there a list somewhere of all the common states for each control? We're restyling them and it would be nice to not have to hunt through each control to figure this out. Basically a list like: Button: Disabled, Hover, Pressed, Selected, Focus, etc. ListBox: Disabled, Hover, Focus, etc I'm looking in Blend and MSDN but not finding a...

xaml date format string ignored

My label is displaying '7/27/2010' instead of 'July 27, 2010'. Can someone please tell me why my markup code is apparently ignored? RibbonLabel Content="{Binding Source={x:Static sys:DateTime.Today}, StringFormat='{}{0:MMMM d, yyyy}'}" Cheers, Berryl ...

Unload event when changing font size in Windows XP

Is it possible to stop the Unloaded, OnApplyTemplate and OnTemplateChanged from triggering when we change the default font size in Windows XP? It's been causing us some problems and we haven't figured out a good way to handle it. If you know what other events get triggered under this situation, it would help us a lot too. Thanks! ...

The specified Visual is not a descendant of this Visual.

Hi, I wanted to show an Adorner Element (As Super Tooltip window) to the Framework element in my application (XBAP application) in two scenarios (Clicking on the element & mouse over on the element). For that I have implemented a custom Adorner Window for showing super tooltip. The adorner element is showing exactly in both scenarios. T...

WPF SimpleCommand possible with generics?

I am using this code to make a Simple Command: public class SimpleCommand : ICommand { public Predicate<object> CanExecuteDelegate { get; set; } public Action<object> ExecuteDelegate { get; set; } #region ICommand Members public bool CanExecute(object parameter) { if (CanExecuteDelegate != null) ...

Styling a TextBox with IDataErrorInfo in WPF

Hello, I'm trying to change style a text box. By now, I have made that my textbox shows an asterisc on the right of its border with this code: <Style TargetType="{x:Type TextBox}"> <Setter Property="Validation.ErrorTemplate"> <Setter.Value> <ControlTemplate> <Grid> ...

WPF 3.5 SP1 V/s WPF 4.0

HI There, i am starting to develop an WPF based application. so i was wondering if i should start with WPF 4.0 or stick to WPF 3.5 SP1. is there any significant changes WRT controls,binding performance ..etc. Thanks for your comments and Recommendations DEE ...

How System.Windows.Threading.Dispatcher in the main UI thread is accessible from other threads ?

I have read that we can not access anything in the main UI thread in Silverlight application from other worker threads. So why it is possible to access an object of class System.Windows.Threading.Dispatcher which is associated with the main UI thread from other worker threads when we want to delegate some work to be done on the User Int...

Stopping a ListBox from reacting to keystrokes without breaking InputGestures for CommandBindings

I want to disable the possibility to navigate a ListBox with the keyboard. My first thought was to set up a PreviewKeyDown handler like so: private void ListBox_PreviewKeyDown(object sender, KeyEventArgs e) { e.Handled = // some logic here ... } Unfortunately this also stops my CommandBindings which are declared in my main window ...

Why doesn't checking out in TFS 2010 give me write permissions? It causes an exception in my project at the target of invocation

Hi, I just moved my code from subversion to TFS. When I get latest version, I understand that I can't get write permissions. However, when I check out and choose the option to take the exclusive lock, a check mark appears next to my files and I am able to edit them. When I look in Windows explorer, however, some files are still marke...