wpf

Data is not getting displayed in WPF User control when used in an application.

Hi, I have a user control - with 2 grids and 4 buttons...buttons used to add/remove values between the grids. There are two properties in this(which i defined in view-model)..."SourceGridData" and "DestinationGridData"...i have implemented onPropertyChanged for these properties. I use this user control inside my wpf application....and...

MVVM: What if the model is changed constantly by a background thread?

This is a big issue for me. I want to write a WPF / MVVM application that fetches data from an online WCF service. Problem is, that the fetching process must be every, say, 15 seconds (it's a time critical application). There is an everchanging IEnumerable involved, every time I check the WCF service, I WILL get different values, becau...

Popping a MessageBox for the main app with Backgroundworker in WPF

Hi there, In a WPF app, I am using a BackgroundWorker to periodically check for a condition on the server. While that works fine, I want to pop a MessageBox notifing the users if something fails during the check. Here's what I have: public static void StartWorker() { worker = new BackgroundWorker(); worker.DoWork += DoSomeWor...

Problem in ListBox ItemTemplate binding using XML as itemssource

I'm having a bit o' trouble... Here is my "mappings.xml" file... <?xml version="1.0" encoding="utf-8"?> <mappings> <mapping QID="info1"> <empty></empty> </mapping> <mapping QID="info2"> <empty></empty> </mapping> </mappings> My method that loads the XML and sets it as the ItemsSource for the listbox: (Note: I didn't ...

How to bind XML with namespace to WPF DataGrid ?

Hello again, I have a use-case where I need to bind data from an XML file to a WPF DataGrid. I prepared this example to demonstrate what I'll be doing in my final code. This is Books.xml: <?xml version="1.0" encoding="utf-8" ?> <library> <books> <book id="1" name="The First Book" author="First Author"> First Book Content ...

Using WPF hardware accelerated drop shadow in ASP.NET server-side?

I'd like to run drop shadow on Bitmap class in ASP.NET and I'd be really happy if GPU could do that. Any chance of this happening? Update: I'd like to do that on server side. It doesn't really have to be ASP.NET app, it could be console app or windows service. ...

WPF custom validator with tooltip

Hi, I'd like to create a custom validator template for my WPF app. I have a tooltip template: <ControlTemplate x:Key="ToolTipTemplate" TargetType="ToolTip"> <Grid Opacity="0.93" MaxWidth="200"> <Border BorderBrush="Black" BorderThickness="1,1,1,1" CornerRadius="2"> <Border.Background> ...

How do I upgrade WPF apps to Framework 4?

How am I supposed to upgrade my WPF applications to the Framework 4? Every time I try to change the target framework to version 4, it keeps telling me that WindowsBase, PresentationCore and PresentationFramework aren't in the targeted framework. This seems to preclude me from using .NET 4, so clearly I'm missing something major here. H...

Filtering a collection inside a collection MVVM

I have a list of project dtos that contain a collection of tasks. On my ViewModel I have an ICollectionView for the projects so I can filter projects that are marked as done see below filter code. public void FilterDoneItems() { if (this.MarkDone) { ProjectsViewSource.Filter = new Predicate<object>(F...

WPF Pass current item from list to usercontrol

I am binding to an ObservableCollection<Stage> Stages as the ItemsSource for an ItemsControl: <ItemsControl ItemsSource="{Binding Path=Stages}"> Is there any way to pass the current stage object to a usercontrol in an item datatemplate like this: <ItemsControl ItemsSource="{Binding Path=Stages}"> <ItemsControl.ItemTemplate> <DataTempl...

In WPF how do you put a border around the part of a window that has focus?

I have a Window that has two primary areas. One is a TextBox inside of a ScrollViewer and the other is a TabControl. I want to have a red border around the part that currently has focus, so I wrote the following code to do that Xaml <ScrollViewer BorderBrush="Red" BorderThickness="0" GotFocus="Border_GotF...

State of the art in MVC architecture?

Seems like there are a ton of possible MVC configurations/architectures (MVC, MVVM, MVP, HMVC, PAC, document-view...). Is there any currently accepted 'best' or state-of-the-art MVC architecture? What is the newest thinking? Or is it all a free-for-all and/or simply tied to whichever platform one develops on (e.g. MVVM for WPF)? (Specif...

WPF: Drawing on top of a TextBlock

I want to be able to draw on to the top of a TextBlock, and have found a way to do this, but i cannot remove the drawing once it is there. Here is the code. public class DerivedTextBlock : TextBlock { public Boolean DrawExtra { get { return (Boolean)GetValue(DrawExtraProperty); } set { SetValue(DrawExtraPrope...

WPF: Replace the XAML of a page or usercontrol (both is ok) at runtime?

I know that it is possible to parse an XAML - file at runtime and create an UIElement which I can insert into my pages grid, no problem there. But what I really want is to replace the whole XAML of my page or usercontrol, is that possible, too? Reasoning: I want to give the users of my application the opportunity to have the applicati...

Dialog Result not set to true in WPF 4

I have just converted my project to wpf 4 , In my previous version I have used the dialog Result set to true when the save but of a showDialog is click but now I don't get the true value of the dialogResult Property . is there any reason or I need to change the code wndWindow childWindow= new wndWindow(); childWindow.ShowIn...

How to set focus on last line of WPF RichTextBox.

I am dynamically adding text in a RichTextBox. How can I set focus on the last line so the user can see it? ...

Integrating Silverlight 4 webcam functions into WPF

After toying a little with the new Silverlight 4 camera features, and being really disappointed that these were not included in WPF, I looked at the Silverlight assemblies and found that they more or less delegate all work to agcore.dll. Do you think it is a good idea to package agcore.dll with my WPF application, and copy/paste or rewr...

How to create Search text box like the one in Expression blend?

How to create search text box like the one in Expression blend? Is it existing control in WPF/Expression Blend? ...

How to populate a DataGrid from XAML? or How to create an ObservableCollection from XAML?

Question I have a DataGrid and would like to populate it with some test data, so I can see it in the designer while working on it. How do I do that? What I already have I've created two classes: ProductList using System.Collections.ObjectModel; namespace Wpf.DataGrid { class ProductList { private ObservableCollectio...

How to rotate transform image inside WPF DataGrid cell?

I am rotating an image inside datagrid using animations based on DataTrigger value. It works fine when vertical scrollbar is not visible, but when records are more and vertical scrollbar is displayed and I scrolls up and down other images also starts rotating, which should rotate bcoz there values doesn't matches with condition. Below is...