wpf

Getting a flowdocument from a xaml template file

I got a Xaml file that starts like this: <FlowDocument x:Name="flowDocument" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Drawing="clr-namespace:System.Drawing;assembly=System.Drawing" Current solution uses a StremReader by ...

Putting a scoll bar on a wrap panel contained within an items control

Hi, Does anybody know how I can add a scroll bar to a wrappanel contained within an itemscontrol? ...

What are the benefits of using WPF over WinForms?

Hello, I have previously written user interfaces using .NET using WinForms. I'm about to start development on a new piece of software. This software is just a simple utility which will make use of Rich Text fields, a few buttons, dialog boxes etc. It seems WinForms is ideally suitable for this. I don't need anything flashy. However W...

Animating the background of a new record added to a XamDataGrid

Ok, I've spent 2 days trying to work out how to do this and have so far achieved a score of 'FAIL'. The design is this: A ViewModel class exposes a public ObservableCollection property called People. A XAML view is bound to this property The desired behaviour is this: Add a new Person to the ViewModel's collection The View animat...

How know who is connected to the application in WPF?

HI All, i wish begin to work about a feature new for me ,i'n my project i have a database( with SqlServer) and an application (developing in WPF) the purpose of this application is to manage/handle about Accountancy and other Departement,so i created a Passwords and Roles(for Users) to access in the application ,now i will create a syst...

Can't set DialogResult in WPF

I show a WPF window using ShowDialog() from the calling window. The window opens and is modal as expected. However, in my OK and Cancel button's click events in the dialog window I set this.DialogResult = true (or false) respectively, and the value does not get set. The window closes as expected, but DialogResult is still null. Is this...

Specify Command for MenuItem in a DataTemplate

I have a context menu. It's bound to some collection and it has a defined ItemTemplate like this: <ContextMenu ItemsSource={Binding ...} ItemTemplate={StaticResource itemTemplate} /> itemTemplate is a simple DataTemplate with a TextBlock: <DataTemplate x:Key="itemTemplate"> <TextBlock Text={Binding ...} /> </DataTempl...

WPF Hyperlink Child

Hi, I have a WPF Hyperlink that I am able to click and get it's NavigateUri property just fine. However, I want to be able to bundle some additional information with the Hyperlink so I can process it in my event handler. This is how it looks right now: <TextBlock Grid.Row="0"> <Hyperlink ToolTip="{Binding Path=Contact.ToolTipPerso...

WPF MenuItem Header and HeaderTemplate

I want to bind a list of KeyValuePair to a list of MenuItems. I thought I should use MenuIten.HeaderTemplate, but it didn't work. I only got blank headers. <MenuItem Header="Template" ItemsSource="{Binding Path=Samples}"> <MenuItem.ItemTemplate> <DataTempl...

How to programmatically create a rectangle/button and make it animate along a curve path?

WPF: How to programmatically create a rectangle/button and make it animate along a curve path? Thank you! ...

How does the WPF ComboBox disable the window from scrolling or resizing

I am trying to recreate some of the behaviors that occur when the combobox dropdown is open. When this happens, if there is a scrollviewer then scrolling gets ignored. The ability to resize the window is disable. I know that there is a ResizeMode, but the results of changing the mode are visibly jarring to the window. If the window goes ...

Undo inside WPF M-V-VM, how does it fit?

In my previous projects, I have already implemented undo system in c++, and I know how it work. I am also aware of the Command pattern. I will be implementing a C#/WPF desktop application and would like to base my design on the M-V-VM pattern. The application will: be relatively a small project (2-3 weeks estimated work for 1 dev)...

WPF: How to handle long running "thread"

good evening! currently i'm developing a wpf-client for some rest-service. the communcation with the rest-service is no problem and is done in an extra assembly (communcation-interface). basically: i have a somehow "search"-button which executes a method. this method communicates with the service, updates some textboxes and a progress-...

How to program a delay of video presentation across shared monitors?

I am looking for a decent programmatic approach to delivering the illusion of "riding in a van". Here is the synopsis: I have a friend who is opening up a bar in San Francisco with a room interior designed to be like the inside of a van (picture the inside of the Scooby Doo Mystery Machine) . Set into the walls are “windows” and behind ...

How to inject a Converter in XAML

I have an IValueConverter implemented class and I need it to be injected using my DI container (Ninject). The problem is, in XAML, there's no immediately obvious way to get control over the instantiation of the Converter object. So my XAML contains a line something like this: Source="{Binding Path=CurrentMessage, Converter={StaticR...

How do you keep view logic out of the model and business logic out of the view-model in MVVM?

I can't quite figure out how to get the view model to be notified of changes in the model without adding a bunch of UI specific stuff like INotifyProperyChanged and INotifyCollectionChanged in my model or create tons of different events and do a bunch of things that feel like they're UI specific and should stay out of the model. Otherwi...

WPF Dragging elements from listbox

In my WPF application I've got a listbox with DataTemplate defined as follows: <DataTemplate x:Key="ListBoxTemplate"> <ui:TaskMonthPreview/> </DataTemplate> and TaskMonthPreview is my custom control defined as follows: <UserControl x:Class="Lista.TaskMonthPreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/...

WPF ProgressBar for Webservice Call

Is it possible to show a ProgressBar to show the Progress of a Webservice Call? I'm using a webservice which calls a SQL Database and returns, on demand, a List of the requested data. Webservice Code public List<LocationUpdate> GetAllLocationsByUserID(int UserID) { MainframeConnectionDataContext db = new MainframeConnec...

How to force the insertion mode in a WPF RichTextBox

Does anyone know how to control the the insertion mode of a WPF RichTextBox. I want to force the RichTextBox to always be in overwrite mode rather than insert. ...

WPF: XamlParserException for a very simple form?!

I don't believe this: Just built a very simple form with one combobox, when user select one item, the label will display the selection. Here is my code: <Window x:Class="WpfApplication8.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Win...