wpf

Dataset validation for type ( C# .NET )

Hello. Im working with dataSets validation in my project. I'm doing validation when DataTable_ColumnChanged event fires in partial class of dataTable, and its doing its job, but i would like to also validate datatype mismach on dataSet level, not UI, to provide custom error message. If [someID] expects number, but someone enters string i...

How can I apply a custom sort rule to a WPF DataGrid?

When the user does a column sort in my DataGrid, I want all null or empty cells to be sorted to the bottom, rather than the top. I wrote an IComparer<T> that makes sure blanks are always sorted downward, but I can't figure out how to apply it to the columns of my DataGrid. Note that the initial sort of the DataGrid, which I'm doing with...

WPF Datagrid binding to list problems

I have a list of custom objects: say Fruits with two string properties Name and Color. These are in a List. private readonly List<Fruit> fruitList = new List<Fruit>(); Then I load fruit objects into the list. I am trying to bind this list to WPF Datagrid: C#: dgFruit.ItemsSource = "{Binding}"; XAML: <toolkit:DataGrid Name="dgFru...

WPF: What is the generic container control?

In HTML the generic container control is a DIV. It doesn't do a anything on its own, but it makes for a great place to hang stuff off. Likewise in WinForms the generic container control was the Panel. Again, this is what I would use as a place holder to later load other controls. What should I use for WPF? ...

WPF DoDragDrop causes control animation to halt

Here's the scenario (simplified): I have a control (let's say, a Rectangle) on the Window. I hooked the MouseMove event to make it initiate a drag&drop. Then in the MouseDown event I let it animate, moving 50 pixels to the right. However, when I hold my mouse down on the Rectangle, the control moves about one pixel, and then pauses. Only...

WPF 3D Camera Animations

Hey guys, I have a double property called cameraAngle which is tied to a rotationtransformation, which is applied to the camera. I have series of 3d tiles with pictures on them (think cooliris), when i click the left key down i want my camera angle to go from 0 - 45 degrees. I know I want to use something like a doubleAnimation, but my...

Commandbindings through xaml

How can I invoke execute and Canexecute methods through XAML? ...

ListView not updating after RaiseCanExecuteChanged is called

I have a ListView that is bound to a collection of view models. The Item template contains a button that is bound to a command on the view model. When I set the property that the ItemsSource of the ListView I call RaiseCanExecuteChanged for each viewmodel. public BindingList<IVehicleViewModel> Vehicles { get { return _vehic...

Inconsistant spacing in listview inside the viewbox in WPF?

hi, Listview.view is gridview and style is applied on each item, to get a look of one bottomline seperating the items. And this listview is in usercontrol and usercontrol is in viewbox. Viewbox has done its functionality, but i am gettings lines with unequal height, when i scroll some lines goes on changing to thick and becomes normal....

ColumnDefinition doesn't expand until resize

Hi, I have a grid where one columnwidth is defined as *. The other columns are defined as Auto. The column with the *-definition contains a usercontrol derived from Panel that also implements IScrollInfo. During this control's MeasureOverride visibility is set to visible on a RepeatButton in another column (the RepeatButton's visibility ...

WPF ValidationRule when control IsEnabled=false

Hi, how do I add a ValidationRule to my control that only fires when the control is enabled? Thanks. ...

Applying animated ScaleTransform in code problem

Hi I am trying to find out why the code below does not seem to work. It does not give an error - it simply doesn't scale. It actually does seem to work if I change it as to my second code sample. Anyone got any idea? Thanks public static void StartMouseEnterAnimation(Button button) { Storyboard storyboard = new Storyboard(...

Creating graphics control in WPF and integrate to other winform application

Hello All, We have a existing applicaiton in winform .net. It has a form which displays a kind of flow chart diagram. Now we want to create a control which has enhanced graphics to display this flow chart. With my limited knowledge on wpf, is it possible - Create a graphics control in wpf which is display the flow chart Integrate this...

WPF: Simplest ItemControl will not display any items

I can't get the simplest idea of an ItemControl to work. I just want to populate my ItemsControl with a bunch of SomeItem. This is the code-behind: using System.Collections.ObjectModel; using System.Windows; namespace Hax { public partial class MainWindow : Window { public class SomeItem { public ...

WPF command canExecute method isn't firing

Hi I have the following listbox template within a WPF Page I want the search button to only be enabled when a checkbox in the listbox has been checked. I am using the MVVM and have a seperate commands class Unfortunately the Canexecute method for my Search button is not being fired Mycommand is defined as public static readonly Rou...

WPF: Binding a Color Resource?

I have an odd problem that's got me stumped. I am modifying the WPF Calendar control template, and for reasons that I explain below, I have to use a Color resource, rather than a SolidColorBrush resource, for my text color. Right now, my Color resource looks like this: <!-- My Colors --> <Color x:Key="MyTextColor">Blue</Color> Now I w...

[WPF/XAML] - Change DatePicker style based on SelectedDate

Hi all, First question here. Anyway, here it goes: I have a XAML Windows with a lot of DatePicker controls (DatePicker from the WPFToolkit on CodePlex). Every DatePicker has a default Value of 1/1/1990 and if no other date is selected, I want (or rather my boss :-) ) to display the Text in gray italic and not in Black. Thus, it makes it...

WPF: FixedDocument in Visual Studio 2008 Designer

It's a well-known bug that Visual Studio shows an error when you try to construct a FixedDocument in XAML. For example, the following snippet <DocumentViewer> <FixedDocument> <PageContent> <FixedPage Width="21.0cm" Height="29.7cm"> <TextBlock>Hello World!</TextBlock> </FixedPage> ...

Adding MouseBindings to Items in a databound WPF ListView.

Hello, I'm trying to get a command in my ViewModel executed when the user clicks on a item in a ListView. When I add a ListViewItem in XAML I can just add a MouseBinding to its InputBindings. <ListView> <ListView.View> <GridView> <GridViewColumn Header="Test" /> </GridView> </ListView.View> <ListViewItem Content="Item...

To property, or not to property?

I am trying to figure out what would give me the nicest code. Which is a little subjective of course, I realize. I have an application that accesses a database for which I have written an assembly that hides details about this database from all the applications that make use of this assembly. I also have an WPF application that makes u...