wpf

What's the best way to create a WPF TextBox that replaces spaces with underscores?

I'm creating a FilteredTextBox in WPF that subclasses the included TextBox control. The FilteredTextBox must only allow characters in the range [a-zA-Z0-9_] to be entered, and I've got that part pretty much working. I've hooked into OnPreviewTextInput to handle typed characters, OnPreviewDrop to filter characters that are dragged and d...

How do I create a two-way link the SelectedItem property of a ListView ?

Hi, I've recently taken over a MVVM project started by someone who's now left the company; It's my first time using WPF, but by the looks of it, it was his first time using both WPF and OOP... Anyway, I've got a ListView in the XAML, and I've got a collection class which doesn't currently contain a "SelectedItem" property. Can someon...

Highlight Search TextBlock

My goal is to create a custom TextBlock control that has a new dependency property, SearchText. This property will contain a regular expression. All occurrences of this regular expression in the text of the TextBlock will be highlighted using a custom style (another DP). My current implementation involves clearing all of the Inline obje...

How to use Dataset desgner and Data Sources windows with WPF and XAML in vb.net 2008?

More moans about WPF: As it seems generally likely that MS are going to get rid of Windows Forms (sooner or later), and I am informed by the same organisation that WPF is 'cool', just exactly how can I use the wonderful graphical data toolset in vb.net 2008? I understand the basic concepts of creating table adapters and multiple queries...

Auto update dialog / Notification for WPF Application

I want a automatic update notification in my application. A message box should appear which tells that an update is available, if user wants then it can download the latest version in downloads folder of windows. Nothing else (user will install it manually) not application. -I'm using Installshield so no Click once solution. Thanks ...

What does 'ItemsSource="{Binding}"' mean?

Hi, I'm attempting to learn WPF by unravelling a frankly nightmarish project written by the guy who was in this job before me. Sorry if some of my questions are pretty much homework-level but I'm trying to work out what existing XAML does, with an insufficient understanding of the concepts behind it... Anyway, I have a ListView with th...

wpf how to fit textbox in rhombus shape control

Hi I have a userControl which pretend to be a rhombus shape control. On this control I have a textbox and label. Entire control looks like that <UserControl HorizontalAlignment="Left" x:Class="WPFDiagramDesignerControl.Components.UcWBSBlock" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.micro...

WPF & MEF UserControl part of a larger view (In design mode)

I want this usercontrol to be Created via MEF but also to have the usercontrol positioned and properties set on it in Blend... How can I force the composition of the imports that the usercontrol requires when I have a 'Concrete' reference to the usercontrol ? What happended to PartsInitializer.Satisfy ? Export for the UserControl ...

Set selected WPF DataGridCell to focused and editable upon event

Woot, first Stack Overflow post! I've been asked to work on a desktop application to improve an inventory process for my company. I dabbled with WPF in school and I figured I'd start there. After researching some, I learned about MVVM, put a design together, and forged ahead. Finally, I'm stuck and looking for some help and also a sanity...

WPF - How to display text on every screen

I have a WPF Window style defined thusly: <Style x:Key="Applet" TargetType="{x:Type Window}"> <Setter Property="WindowStyle" Value="None" /> <Setter Property="WindowState" Value="Maximized" /> <Setter ...

Using Multibinding.StringFormat in codebehind

I have this application that has dynamic language switching built in. Based on the selected Culture, strings throughout the application will change. Translated strings and their original values come out of resource files. I use bindings to attach the resource values to buttons, labels, etc. Most of this binding occurs in the code beh...

how and where to use DependencyProperty

I am new to WPF so after reading for a while I deduce that my problem needs to be handled with this pattern: DependencyProperty. I want my toggleButton to have another boolean property. My problem is where should I assign this property, and how? Inside the object that is bound to the toggleButton? Let's say I have a class cell (which ...

WPF Datagrid Template column edit event and alternating column color

I have been using WPF for quiet sometime. I know DataGrid in WPF does not have a Column collection as dependency property so columns cannot be added dynamically. The application I am developing is highly dynamic so the number of columns are not known. So I am creating DataGridTemplate columns from code behind. Problem 1 : I want alter...

Global Keyboard Event

I'm trying to capture key down events from the MainWindow, but I have a treeview which currently has focus is grabbing them before they reach my other class. The TreeView is hooked into the PreviewKeyDown event and does some processing to ignore certain keystrokes. I was hoping by hooking into the main window it would ignore that previ...

WPF ObservableCollection: How to add a blank line in one form's combobox, but not actually affect the ObservableCollection?

I have a static ObservableCollection in a Data Repository class. I use it to populate a combobox on one of my forms (which needs to be able to include a blank line which represents NULL). I use the same ObservableCollection to populate a DataGrid, so I don't want the blank item in the actual ObservableCollection. How do I actually do th...

WPF Textbox loses original values, even if the user doesn't udpate

Hi, I am having a very strange issue. I have a datagrid which is binding to an observable collection of type Person The selected item is bind to an Object Person. I have 2 textboxes firstname and lastname. When ever user selects an item from grid, the textbox values gets populated. user can edit the values and click submit button, val...

WPF DataGrid: CommandBinding to a double click instead of using Events

I know how to use the MouseDoubleClick event with my DataGrid to grab the selectedvalue, but how would one go about using command bindings instead? That way my ViewModel can handle the logic. So far I have the following: <DataGrid Name="TestGrid" Grid.Row="2" Grid.ColumnSpan="2" AutoGenerateColumns="True" MouseDoubleClick="TestGrid_Mou...

Set a certain WORD as Selected/Highlighted in WPF RichTextBox from the ViewModel ?

Hello, I have a List of items in my ViewModel. Every Item represents a Row in a DataGrid. Every Row has a column with a RichTextBox as cell editor. I am searching data in the database. The ResultViewModel has the search word And the index of the column + row in the datagrid where the searched word is located. Now I need a method in th...

Create common context menu in WPF

In my app I have many grids (Infragistics). I would like to create a context menu that will implement many of the common functions ie: delete, save layout, etc. and if a specific grid needs more than the common functions be able to add to the menu for that grid. I would like to create one context menu and not have to repeat the same co...

WPF: Expand the validation rectangle

This is my current XAML. <StackPanel Orientation="Horizontal" Grid.Column="3" Grid.Row="1"> <Label Content="Allocated:" FontSize="14"/> <Label Content="{Binding AllocatedUnits, Mode=OneWay, ValidatesOnDataErrors=True}" ContentStringFormat="N0" FontSize="14"/> </StackPanel> How would I change this so that the red validation rec...