wpf

How can WPF objects deriving from Freezable be frozen in XAML?

Many types in WPF derive from Freezable. It provides immutability to mutable POCO objects and allows for improved performance in certain situations. So my question is, how can I freeze objects in XAML markup? (Note that I have posted a similar but different question too). ...

In what scenarios does freezing WPF objects benefit performance greatly?

Many types in WPF derive from Freezable. It provides immutability to mutable POCO objects and, apparently, allows for improved performance in certain situations. Has anyone found that freezing objects within their WPF application has greatly improved performance? If so, then which items gave the biggest performance difference when bei...

How to pass the following paramter? HitTestParameters3D in VisualTreeHelper.HitTest(,,,)?

Hi, I am trying to pass the HitTestParameters3D parameter to VisualTreeHelper.HitTest(,,,) but I've failed to find any examples as to how this can be done and information about HitTestParameters3D is scant. Help is appreciated. Thanks Q ...

How do I update an existing element of an ObservableCollection?

I have an instance of ObservableCollection bound to a WPF listbox with two separate data templates (one for display, one for editing). The data template for editing has a one-way binding on the textbox, and a Save button. What changes do I need to make so that when I press the Save button (after putting the list item in edit mode), the...

Two Way Data Binding With a Dictionary in WPF

I'd like to bind a Dictionary<string, int> to a ListView in WPF. I'd like to do this in such a way that the Values in the Dictionary get updated via the data binding mechanism. I don't want to change the Keys just the Values. I also don't care about adding new mappings to the Dictionary. I just want to update existing ones. Setting the ...

Qt versus WPF/.NET

My company is trying to make the decision between using Qt/C++ for our GUI framework or migrating to .NET and using WPF. We have up to this point been using MFC. It seems that .NET/WPF is technically the most advanced and feature-rich platform. I do, however, have several concerns. These include: Platform support Framework longevit...

How does NameScope in WPF works ?

I'm having a strange behavior with NameScopes in WPF, I have created a CustomControl called FadingPopup which is a child class of Window with nothing special inside. <Window.Resources> <local:FadingPopup> <Button Name="prec" Content="ahah"></Button> <Button Content="{Binding ElementName=prec, Path=Content}"></Button> <...

How can I be notified when Windows XP fades the screen to gray?

We have an application developed in C# with WPF (.NET Framework 3.0) The main window has a glass border, and a child window containing a WebBrowser is centered within it: WPF main window -> Child window - frame control -> Page -> WindowsFormsHost -> WebBrowser Because we used .NET 3.0, we have to put WebBrowser...

Localization support for Chinese

Hey guys... I need to support Chinese in one of my application on Windows, the problem is that I need to support for Chinese Mandarin and I did not find any locale code for it, can you clarify whether Windows support Mandarin chinese or is there any alternate?? ...

Difference betwwen Datacontext and ItemSource in WPF

Duplicate of : http://stackoverflow.com/questions/793340/who-has-the-best-answer-for-why-datacontext-and-itemssource-are-not-redundant/793350 In WPF we can assign list of item to ComboBox in 2 ways //CODE #1 //WPF <ComboBox name="cmbItems" ItemSource={Binding} /> //C# cmbItems.DataContext = someList; another way, directly assign...

Track down memory leak in WPF

Hi Context: We are building a framework for rapid delivery of WPF applications. This framework uses Autofac as an IoC container and also uses regions from Prism v1. We are scheduling tasks with Parallel extensions from Microsoft. We are facing the following problem: When we boot the application with empty views (so just a shell with re...

WPF converters: where does the culture come from

I've created a WPF converter class: public class DoubleConverter : IValueConverter { public object Convert(object value, Type TargetType, object parameter, CultureInfo culture) { //blah blah } } I wonder who sets the culture parameter that is passed. I would expect it to be the same as the current windows settings,...

Loading BitmapImage in code

From my assembly (A) I want to call a method in another assembly (B) which passes an image. This image is then shown in a WPF Window - the window is part of B's project. I can't seem to pass an ImageSource with a pack:// uri as this gets evaluated in the context of B, so I guess I need to cache the image using CachedBitmap (?) when stil...

In WPF how can I bind to the ViewModel and have various XAML elements bind to the ViewModel's methods?

I can bind a ListBox like this: XAML: <UserControl x:Class="TestDynamicForm123.Views.ViewCustomers" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <StackPanel Margin="10"> <ListBox ItemsSource="{Binding}"/> </StackPanel> </UserControl>...

WPF/C# Textwrapping in a scrollviewer makes window resizing laggy

Hy. I have got a ListBox with a scrollviewer in it. Each item (40++ items) of the listbox contains a textblock and a small image. When I resize the window, the resizing is very laggy. If I put the textblock visibility of the items to "collapsed", the resizing is okay. My first approach was to set the visibility of each item not display...

Why is this View not correctly binding to this ViewModel?

I'm trying to bind my view to my view model without DataObjectProvider. The following code runs without an error, but my ListBox is empty. As far as I can tell, I correctly: set the View's DataContext to the ViewModel itself (DataContext = new CustomersViewModel();) expose the customer objects in the ViewModel (public static Observab...

Wpf DataGrid : changing the XML field binding at runtime

I am developing a WPF User Control for displaying portions of XML files. I'm trying to make the User Control flexible, so that I can assign the column headings and field data bindings from the outside of the control. I've found that I can easily change the column headings, but while the following code seemed to have promise, SertMember...

Can you define multiple TargetTypes for one XAML style?

In HTML/CSS you can define a style which can be applied to many types of elements, e.g.: .highlight { color:red; } can be applied to both P and DIV, e.g.: <p class="highlight">this will be highlighted</p> <div class="highlight">this will also be highlighted</div> but in XAML you seem to have to define the TargetType for styles,...

Keyboard modifiers during application startup

I wanted to capture whether a modifier key was being pressed during application startup (to determine fullscreen or windowed). In the main window constructor I tried checking the Keyboard.Modifiers enum to see if Shift is down. It always showed 'None'. So I tried a different approach by starting off a DispatcherTimer and checking for ...

How can I get ScrollViewer to work inside a StackPanel?

In the following WPF XAML the ScrollViewer does not work (it displays a scroll bar but you cannot scroll and the contents go off the window to the bottom). I can change the outer StackPanel to a Grid and it will work. However, in my application from which I reproduced the following code, I need to have an outer StackPanel. What do I ha...