wpf

Force DataGrid into edit mode when using ListView for CellTemplate

Greetings, In an WPF DataGridTemplateColumn I have a CellTemplate using a ListView and a CellEditingTemplate using a DataGrid. <DataTemplate x:Key="LimitsTemplate"> <ListView ItemsSource="{Binding Limits}" IsEnabled="False"> <ListView.ItemTemplate> ... </ListView.ItemTemplate> </ListView> </DataTem...

WPF Application is slow / jerky whilst being moved

I have a rather basic shell of a WPF app that I am creating. When I move it using the DragMove() function the app moves properly but seems to "jerk" a lot. It seems to me that the redraw rate is very low making the application look slow and unresponsive. Currently there is no "code" besides a call to DragMove(). The XAML consists of a...

Why will my WPF designer not load?

I've got a project with about 20 window designs, all of which were loading OK. Today, any time I open a designer for one of them I get "The type 'Grid' does not support direct content". Does anyone know why this might be? EDIT I'm unable to delete the question. It was a problem with my computer's hard disk. New disk installed and softw...

Three state button in Silverlight

I have a button with 3 States Start/Resume/Pause. 1 Is this a good pattern to solve this or maybe there is some toggle button mode that I am not aware of? private void cmdStart_Click(object sender, RoutedEventArgs e) { if (m_end) { // Reset the game. m_end = false; cmdStart.Conten...

How to programmatically set SelectedItem of a data-bound WPF ComboBox?

Question: Can anyone please provide a full code example that shows how one does programmatically change the SelectedItem of a data-bound WPF ComboBox without using MyComboBox.SelectedIndex? Code sample: Here is what I currently have. XAML: <Window x:Class="Wpf.ComboBoxDemo.MainWindow" xmlns="http://schemas.microsoft.com/winfx/...

Setting default value of DateTimePicker

Currently my DateTimePickers are blank, I would like them to have a default setting i.e Today.AddYears(20); & Today.AddDays(5); What I have done at the moment is 'DateTimePicker.Text = DateTime.Today.AddYears(-100).ToString();' As you can probably tell, this isn't working hence why I'm asking the question. Bit of information :- I nee...

Entity Framework - Binding WPF Tree view control

In Service Category table, ParentCategoryId is the ServiceCategoryId and that is the parent category, there can be nth level hierarchy of my categories, so I need to present this using Tree View Control. How can I do this? Thanks ...

Linear navigation in WPF MVVM

Hi, I'm using the Cinch MVVM framework, however I think this is something that relates to all WPF approaches. I want to have a primary screen - Shell or MainWindow - which then contains various viewmodels. To navigate between viewmodels I'm using (or going to use) a tab control styled as a button strip with the content area beneath - w...

NHibernate notify other sessions about changes

Hello, My application consists of two views, list and detail. Every instance of view has it's own NHibernate session. When user saves entity from detail view, an event is published to the list view (entity id) after that, list view re-fetches modified entity using it's own session. In order for list view's session to get fresh versio...

In WPF how do I implement ICommandSource to give my custom control ability to use Command from xaml?

Could you please provide a sample, of how do you implement the ICommandSource interface. As I want my UserControl, which doesn't have the ability to Specify command in xaml, to have this ability. And to be able to handle the command when user clicks on the customControl. ...

WPF DataGrid Binding DataGridCell Content

Hi there, This is hopefully going to be a really simple answer, I'm just not seeing the proverbial wood for the trees I think. I've got a DataGridCell style in which I want to bind the content of the cell to the source property of an image, here's the XAML I'm using at the moment: <Style x:Key="DataGridImageCellStyle" TargetType="{x:T...

Debug WPF on client machine

Hi what is the best way to catch errors in a wpf application. I already added the following to my app.xaml.cs: void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { var stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("{0}\n", e.Exception.Message); stringBuilder.Appe...

What is the better way to use WPF,WCF,PRISM

hi, I'm developing an EMR Application as my project. there Im using WCF to transfer all the data from the centralized server , WPF for the UI and PRISM to build modules. I have 3 projects in my solution for WPF/PRISM application The Main project(mainApplication) where the shell and bootsrapper are. Class library(modulesLib) to hold ...

could not capture down arrow in combobox in wpf

Hi Experts, I have a combobox on a window in wpf and i am trying to capture the down arrow key of this combobox but i am not able to do so. The following is the only code i have for the combobox. <ComboBox Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="comboBox1" VerticalAlignment="Top" Width="120" Previe...

Why is WPF DataGrid showing a class name in the header?

I have created a custom style for my WPF datagrid by overriding its control template - nothing unusual, just copied the original template and modified it. Unfortunately, when the grid is drawn, the fully qualified class name of my ViewModel is showing up in the header (the ViewModel happens to be the DataContext of the UserControl that c...

How can I control the SpeedRatio of a Storyboard inside a VisualState?

Given a Storyboard started by the VisualStateManager as part of a ControlTemplate, how would I adjust the SpeedRatio of that animation based on property changes of the control? <ControlTemplate> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup> <VisualState> <Storyboard Name="SpinningThing" ...

How do I load an rtf file to a WPF RichTextBox in Powershell

Anyone know hoe I can load an rtf file to a wpf RichTextBox? In Windows.Forms I would do this RichTextFile.Loadfile(c:\myfile.rtf) but I don't know how to achieve the same in WPF! Thanks, Ben ...

WPF, nothing shows up in ListBox

I don't know what I'm doing wrong here. I have a ListBox whose DataContext and ItemsSource are set, but there is nothing in the ListBox when I run my app. When debugging, the first line of my method for getting items for the ListBox never gets hit. Here's what I have: // Constructor in UserControl public TemplateList() { _templat...

Display image in content presenter in button

I have a button with a style that displays an image inside it. I would like to be able to specify the image it uses using the Content property on the button (or some other means). How can accomplish this without actually nesting an image directly in the button. <BitmapImage x:Key="closeImage" UriSource="close.png" /> I thought I co...

XAML animation to bound property

I have the following Rectangle bound to an ever-changing positioning property "RectTop" <Rectangle Canvas.Top="{Binding RectTop}" Height="100" Width="100" Fill="Red" /> Is there I way I can set up an animation/trigger to smoothly animate the rectangle to RectTop whenever that value changes? RectTop changes constantly. RectTop's class ...