wpf

How can I get a close button on a templated TabItem in WPF?

I have a tabcontrol where the tabitem's are datatemplated. The template seems to work correctly, in that the usercontrol I want to show in the tabitem is showing correctly. What I am not sure of is how to get a "x" to show up in the tabitem so I can close each tab, since they are dynamically generated through a template. Being fairly ...

How to insert a unicode character in a rich text box?

I'm writing a WPF application with a RichTextBox and a Toolbar (a VERY simple RichText Editor). Anyway, I want to put 6 unicode characters in the ToolBar that can be clicked and will be inserted at whatever point to the RichTextBox. This seems like something that should be fairly simple to do (without a lot of codebehind). Is it, or do ...

How to center a WPF app on screen?

I want to center my WPF app on startup on the primary screen. I know I have to set myWindow.Left and myWindow.Top, but where do I get the values? I found System.Windows.Forms.Screen.PrimaryScreen, which is apparently not WPF. Is there a WPF alternative that gives me the screen resolution or something like that? ...

DataBinding with DataContext

Hi, what am I doing wrong here? I'm trying to create a DataTemplate using a collection inside the DataContext object, like the following: C#: namespace StackOverflowTests { /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { I...

Dynamically loading code-behind along with XAML?

Hi, Related to this question I asked earlier, I wonder if it's possible to also dynamically load a code-behind file that is paired with a XAML file. Can it work this way or would it just be better to compile both into a DLL?. Thanks! ...

Adding controls from a third party never work.

Hi, I have been trying to add components from a third party application but they never seem to work or they draw incorrectly. I can take my xaml file and move it to the sample project that came with the third party control and it would perfect but just not in my own project. (I am using Visual Studio 2008). I have tried numerous times t...

WPF PasswordBox Caret

Is there a way to hide or move the PasswordBox's caret? ...

Get Width Available for Children in a Scrollviewer

Hi, How do I get the width available for the children of a scroll viewer in XAML? Thanks. ...

C# Winforms-WPF interop

Currently I have a Winforms app which relies on transpareny effects. However this is proving to be an absolute pain in the preverial behind! Winforms as Im learning doesn't deal with transparency particularly well. I was wondering whether or not this would be any easier using WPF components for the transparency bit and winforms for the ...

Is it possible to toggle a menu from keyboard input?

I'm building a dashboard'ish application for a special purpose hardware that has physical buttons that are bound to F1-F10, Up, Down, Backspace, Enter. The application consists of a few views (implemented using the MVVM-pattern) and most of the user interaction are done with menus that are aligned near the physical buttons. I'm trying to...

How can I use a custom TabItem control when databinding a TabControl in WPF?

I have a custom control that is derived from TabItem, and I want to databind that custom TabItem to a stock TabControl. I would rather avoid creating a new TabControl just for this rare case. This is what I have and I'm not having any luck getting the correct control to be loaded. In this case I want to use my ClosableTabItem control in...

Problem binding to static property

I'm having a hard time binding a simple static string property to a text box. Here's the class with the static property: public class VersionManager { private static string filterString; public static string FilterString { get { return filterString; } set { filterString = value; } } } In my xaml, I j...

c# WPF transparency over Winform controls

I have a WPF control that I would like to overlay onto a WinForms application. So I have dutifully created a Element Host that can show the following WPF object: <UserControl x:Class="LightBoxTest.LightBox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...

WPF SolidColorBrush dilemma

Hi All, Does anyone know how to convert a string that represents a color into a SolidColorBrush in wpf? For e.g: string colorRed = "Red"; SolidColorBrush fromStringToColor = new SolidColorBrush(colorRed); That's sort of what I'm trying to accomplish. Any ideas? Thanks in advance. ...

Filtering the files shown in OpenFileDialog based on content?

Hi, Is there a way to modify the behavior of the OpenFileDialog so that it looks inside the files in the folder it opens to and then ignores certain ones based on their content? One example would be to open to a folder full of Zip files but only show the ones that contain a certain file. From the documentation, there's the HookProc b...

How do I create an F# list containing objects with a common superclass?

I have two functions, horizontal and vertical, for laying out controls. They work like this: let verticalList = vertical [new TextBlock(Text = "one"); new TextBlock(Text = "two"); new TextBlock(Text = "three")] Now verticalList is a control that displays the three textblocks ...

select tabItem programmatically in WPF

Hi I have different tabItems in a TabControl and each tabItem has some input fields. I am moving between the tabItems programmatically (like a wizard to move from the first to the next) I am using this code inside the "Next" button tabItem2.isSelected = true; my problem that when I move between the tabItems by clicking on them, the ...

Send to tray on Close.

How can I send the window minimized to tray when on click close button? Also how to show icon in tray when application start? ...

Make WPF textbox as cut, copy and paste restricted.

How can I make a WPF textbox cut, copy and paste restricted? ...

Getting the application's directory from a WPF application

I found solutions for Windows Forms with AppDomain but what would be the equivalent for a WPF Application object? ...