wpf

What is your experience with abandoning MVVM for UserControl-based WPF architecture?

We built an large application based on Composite Application Library and MVVM using Infragistics controls. In order to save time and make the application more straight-forward, we scrapped the MVVM requirement. We now have no Presenters or ViewModels and our Views have become simple UserControls which are created like this: BaseEditor....

Begin Storyboard on more than one target

I have a subclassed ListBox with a "SelectedItemChanging" dependency property that is set to a Storyboard. When the selected item is changed, I want to run this Storyboard on each item in the ListBox. How is this possible with a single instance of Storyboard? ...

WPF - data binding window title to view model property

I'm trying to bind my window title to a property in my view model, like so: Title="{Binding WindowTitle}" The property looks like this: /// <summary> /// The window title (based on profile name) /// </summary> public string WindowTitle { get { return CurrentProfileName + " - Backup"; } } The CurrentP...

Binding problem which drives me crazy

Hello, I (and other programmers from another forum) have been trying to solve a binding problem for a few days. No one could help... Will anyone here be able to help me ? Apparently, the problem seems quite simple but when you dive in it, trust me, you burn some neurons... Here it is : I've created a test project which reproduces the pro...

Bind to ItemsControl's DataContext from inside an ItemTemplate

I have an ItemsControl whose for the ItemTemplate DataTemplate contains a Button. I want the Command on the button to bind to a Command on the DataContext of the ItemsControl, not the ItemTemplate. I think the solution has to do with using RelativeSource, but my attempts so far have failed: <ItemsControl ItemsSource="{Binding Games}"> ...

WPF: How Do I edit the column properties of a base/parent class in the child class through the property editor/XAML?

I have created a class called ProductionDataUserControlBase and it derives from class UserControl. This base class has no XAML. Its purpose is to act as a base class for a grid that I encapsulate inside the class so that it can be modified when the class is inherited later. Inside the constructor of the base class, I also create the colu...

How to programmatically access Control in WPF Grid by row and column index?

Once Controls have been added to a WPF Grid, is there a way to programmatically access them by row & column index? Something along the lines of var myControl = (object)MyGrid.GetChild(int row, int column); ... where GetChild is the method I wish I had! ...

Where to start with building a blotter

I need to build a blotter using csharp and WPF. Basically, like an excel sheet but would have the capability of customizing backgrounds of each cell or setting the value of each cell. But not sure where to start. If anybody build blotters in csharp or WPF, a few pointers on where to get started would be great. If you can suggest some go...

WPF - sequential animation simple example

Hi, I'm learning about WPF animation, and am confused about how to apply animations sequentially. As a simple example, I've got four rectangles in a uniform grid, and would like to change the color of each one sequentially. Here's what I have so far: public partial class Window1 : Window { Rectangle blueRect; Rectangle redRect...

Need example of WPF Gradiant Picker

I'm looking for a WPF Gradient Picker example and source code. The goal is to allow the user of a WPF application to pick the gradient brush to use for a background or foreground. I've seen pickers in Blend (too confusing for a casual user) and Photo Shop. I'm looking for a WPF implementation of something along the line of the Photo S...

WPF Databinding to Custom Collection Objects

Public Sub New(ByVal log As Entities.LogSystem) InitializeComponent() Me.DataContext = log End Sub This is the the initializer for my custom control It passes in a single entity that has several property fields. This control is added to a parent control so that it appears in a stackpanel. Anyway I am trying to get the speci...

C# - how to block for GUI or an event

Hi, I'm trying to create a very simple version of the game Simon with the WiiMote, using WPF. What I'm stuck on is how to make it turned-based, where the program blocks until the GUI is done displaying a sequence. Here's the code I have so far (mostly based on an answer here: http://stackoverflow.com/questions/1511870/wpf-sequential-an...

C# WPF PropertyChanged event always null

I have the following (abbreviated) xaml: <TextBlock Text="{Binding Path=statusMsg, UpdateSourceTrigger=PropertyChanged}"/> I have a singleton class: public class StatusMessage : INotifyPropertyChanged { private static StatusMessage instance = new StatusMessage(); private StatusMessage() { } public static StatusMessag...

Modify XAML string dynamically

Hi, I want to add/remove some part of XAML dynamically i.e. from code behind file in C#.how to Add any specific XAML string on specified location (means under some tag) from .cs file. Please help. ...

Styling of data in data grid in wpf

I have data being populated into my data grid.Now,In the last column I have data like "Out of Balance " and "Inbalance". I want the display to show all "out of balance" data as being underlined and red in clour while the "in Balance" data to be green in colour without any underline.Note that, the stored proc would give me initially all t...

WPF Glass window fallback?

Creating Glass window is as easy as calling DwmExtendFrameIntoClientArea in WPF, but that is only half of the trick. If you disable aero, and get the XP-like skin thats where the pain begins: In XP (or disabled aero) you must call DrawThemeBackground in order to get "transparent like feel", Internet explorer does this too on its top, tr...

How to bind Window background to a theme's Window background color?

How can I bind the default Window background color of the theme to a Window background? I've tried the following: <Window x:Class="Shell" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Shell" Height="300" Width="300" Background="...

How to make System.Windows.MessageBox buttons styled?

I'm using System.Windows.MessageBox in a WPF app, and for some reason its buttons are styled the Windows 2000 way - not WinXP, not Aero, not the WPF default. Just gray with basic 3d borders. How can I make them appear with a more modern style? (doesn't really matter which one) ...

WPF How to erase a DrawingVisual with RemoveVisualChild

Hi, Using WPF I'm drawing symbols in the "fast way" (Drawing rendered on DrawingVisuals, no Shapes). So... I can successfully draw them and get hit-tested with no problem. But when trying to remove them, using RemoveVisualChild() plus RemoveLogicalChild(), there is no effect on the screen: No visual removing. I'm implementing my own dis...

WPF Menuitem Border

Hey everyone, I've run into a problem trying to implement a Menu and can't figure out what is going on. I'm trying to make a single-layer menu using the Menu control. Here is my menu code: <Menu DockPanel.Dock="Top" Height="22" Name="menu1" VerticalAlignment="Top" Background="#FF325170"> <MenuItem Header="Featured" Style="{Static...