wpf

Custom/user control

Hello! I have such task - to create control that union two controls (DataGrid from WPFToolkit and standard Toolbar). On a large scale, it doesn't matter what particular controls it unions, I need to find out the common practices that can be used to build what I need. At first glance, I need something like user control, i.e composition ...

WPF - MergedDictionary using RibbonControlsLibrary in xaml

In code behind, this works: this.Resources.MergedDictionaries.Add(Microsoft.Windows.Controls.Ribbon.PopularApplicationSkins.Office2007Black); How do I do this in xaml? ...

Problems with DataGridTemplateColumn with ComboBox

I have a DataGrid template column with ComboBox. When I select a value and press enter the bound data is not updated (I see empty cell). XAML: <Window x:Class="WpfGrid2.Window2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;...

WPF listbox empty datatemplate

I was wondering how people handle a ListBox control that has no items? e.g. I want to bind a list of search results but if no results are found i would like to display "No results found". The way i currently tackle this is that i hide the listbox if the result set count = 0 and show a label with the "No results found" message. Ideally ...

Disable backspace in wpf

Hi I am working in a WPF application, using C#.net I want to know, is there any way to disable BackSpace button on a particular xaml page. I want to prevent user from using the backspace button on this particular xaml page. Even if the user presses the BackSpace button, no effect should take place. Thanks ...

VS2008 crashes with "Fatal Execution Engine Error"

Has anybody found a fix for Visual Studio crashing with this error (eventlog)? .NET Runtime version 2.0.50727.3082 - Fatal Execution Engine Error (7A2E1132) (0) It does this when I start debugging with a problem in the xaml. Visual Studio will then silently disappear. I've looked at SO and MS Connect but haven't found a fix or wor...

WPF ListBox SelectedItem sometimes is not visible (scrolling is out of sync)

Hello, I have a Listbox that is filled with 30,000 elements <ListBox Name="lbWordlist" Grid.Row="1" Margin="10" ItemsSource="{Binding Source={StaticResource WordListViewSource}}" SelectedItem="{Binding Source={StaticResource MainViewModel}, Path=SelectedArticle}" IsSynchronizedWithC...

Set Parent Visibility to nested Child Visibility

I have the following <ControlTemplate x:Key="RoundedTopPanel" TargetType="{x:Type ContentControl}"> <Grid> <Border CornerRadius="9.5, 9.5, 0, 0" Padding="10" > <ContentPresenter/> </Border> </Grid> </ControlTemplate> and then use it as <ContentControl Template="{StaticResource RoundedTopPanel}" Grid.R...

WPF - Binding to a Menu Icon.

I've got a UserControl that contains a menu. I need to bind the Menu.Icon to a property of the UserControl but it's not working. The code starts like this - <Border Grid.Row="0"> <DockPanel> <Image x:Name="testImage" Height="16" Width="16" Source="{Binding ElementName=UC,Path=AddImage}"/> ...

non standard shape antialiased WPF window

I'm using C# to create a non standard shape WPF window, and because of some problems with "AllowTransparency=True", I used CreateRoundRectRgn, CreateEllipticRgn and SetWindowRgn win32 API Region functions, but there's a problem cause the edges are not smooth as you can see in the picture here http://img17.imageshack.us/img17/206/sampley....

WPF Resize Windows

I maintain a touch screen application that I'm re-writing into .Net. Through the years the resolution of the touch screens has increased greatly. Not only is the resolution higher, but the pixels are also much more dense making it harder to see/operate the touch buttons. Is there a way with WPF to force application windows to scale t...

Will WPF process an App.xaml file if the hosting application isn't WPF?

First I just want to say I am new to WPF, so please excuse my ignorance... I am creating a .Net plug-in for Rhino 4.0. With the plugin I am developing a UI using WPF. The Rhino 4.0 CAD engine is an MFC/Win32 application. The plugin will execute after the application is run, and it creates the WPF Window and then "sucks" the MFC Windo...

How to catch an exception that won't happen while debugging?

I have some image processing code that runs on a background thread and updates an Image control on the UI thread when it's done processing using Dispatcher.BeginInvoke(). When I'm running my application outside of the debugger, it crashes quite often. As soon as I run it in the debugger, I can't get it to happen at all. Apparently the ti...

What is a good book for learning advanced WPF material?

I've been dabbling with WPF for about 6 months now and I'm pretty confident with 90% of the Framework. I read WPF Unleashed by Adam Nathan,cover to cover, twice, to get up to speed but now I'm ready for something more advanced. Can anyone recommend a good advanced WPF book as a next step? Thanks in advance. ...

WPF: changing the font of all controls in a given container

How can I change the font of all the child controls in a container, for example a Canvas? I want to have a slider so the user can control the font size of everything in the screen at once. Thanks ...

Set selected item in a databound list box

I've got a wpf listbox that is bound to a datatable. At some times, I want to programmaticly change the selection of the listbox. I know the text of the item I want to select. But it doesn't work to set the listbox1.SelectedItem to the text I want because the type of the SelectedItem is System.Data.DataRowView. If I have the text I want...

WPF TextBlock dynamic bold and italic parts

Hello, I'm using MVVM pattern and I have string type property in my ModelView. The string may contain following HTML tags: <b>, </b>, <i>, </i> I need to make certain parts of text in TextBlock to be in normal, bold or italic. At moment I have created workaround, a helper method that works like this: Breaks HTML string into parts...

WPF Component Obscures Subcomponents in Designer

Some components like the viewbox are displayed in the visual designer as solid boxes. However, they can contain subcomponents. To view the subcomponents I comment out the viewbox. When I'm done I have to remove the comments to restore the functionality. It's rather annoying. Is there any way to permanently make the viewbox invisible ...

WPF Lock Window Size to Viewbox Size

I have a window that contains a resizable viewbox with a uniform stretch. The window frame however does not stretch uniformly. So when someone resizes the form gaps of whitespace open up along one or another edge of the form. Looks bad. Any way to force the window to only expand uniformly? (or another way to look at it, lock it to t...

finding the zorder of a window

I have a wpf application, for which I need to find out if any other window is over the current window. I can not use IsActive, as that you could have 2 windows side by side (for example IE and the wpf application) and have the other application be active, but not over top of the wpf application. Essentially I want to know if anything i...