External WPF binding styles without XAML tag

If I have a WPF DataGrid that looks like this: <DataGrid x:Name="DataGridQ" AutoGenerateColumns="False" Grid.ColumnSpan="2"> <DataGrid.Resources> <Style TargetType="{x:Type DataGridRow}"> <Sette

the content does not appear in DataGrid

Well, I have a data class with some data objects like this: private ObservableCollection<bool> check = new ObservableCollection<bool>(); public ObservableCollection<bool> Check { get { return check; } set { check = value; Notify("ch

Saving a RichTextBox to an RTF file

For a project I am working on I am trying to save the contents of a WPF RichTextBox to a RTF file as the title states. I have it working for the most part. However, the file does not preserve newlines. When I save the file ( as you will see below ) i

Editable ComboBox link and update source trigger

Requirement I want to have ComboBox where user may enter some text or choose text from drop-down list. Binding source should be updated when user press Enter after typing or when item is simply selected from drop-down list (best View behavior in my c

Determine the "actual size" of a visual element

I'm creating a control that allows the user to create a visual element that can be printed. The challenge is the user can change the size of visual but needs to know the actual size of the visual they are creating. In other words I have the size of t

How to focus on the item in the list?

I have a defined list box like this: var listBox = new ListBox(); listBox.Items.Add(1); listBox.Items.Add(2); listBox.Items.Add(3); And I want to set focus directly to an item in the listbox. If I do this: listBox.SelectedIndex = 0; listBox.Focus();

View and edit ObservableCollection & lt; & gt;

I want to be able to display and change the values of ObservableCollection<> in UI. Does it possible? I display it with ListView but I can't change them.You could use a DataGrid instead of a ListView. DataGrid allows cell edition.

Tabcontrol in WPF C #

now I'm using the tabcontrol to arrange my UI. At the first, I put my button outside my tabcontrol; however, when I put the button into the tabcontrol, it gave message, Object reference not set to an object instance. Does anyone know why I got this m

How to manage multiple windows and dialog boxes in MVVM?

Is there any standard method for showing dialog windows, opening and closing them and retrieving data from them, using the MVVM pattern? I have seen this:http://www.daedtech.com/mvvm-and-dialogs I want use for show a dialog for special (View/ViewMode

Converting my multi window WPF application into one window?

I made a WPF app that opens successive windows based on user interaction. For example, the first winodw asks what module the user wants to work on, when a selection is made and a button pushed, a new windows open showing some Vendors and summary coun

Change the content of the button in WPF

I have: private void button1_MouseEnter(object sender, EventArgs e) { for (int i = 0; i > 2; i++) { button1.Content = Convert.ToString(i); System.Threading.Thread.Sleep(1000); } tekst.Text = "Mouse Enter"; } When I enter on Button I see only

Link to the chain of self-control

I have a custom converter that I want to make use of in xaml. The converter just places Admin if value is equal to 0, Cashier if it is equal to 2 etc.. Anyways this is what I am looking for. <ComboBoxItem Content="{Binding 'I want to place the val

Tabulation data lost on the selected item has changed MVVM

I have been trying to do this for ages and having no joy whatsoever. I have a ribbon window of the following hierarchy: MainWindow MainContent (Tab Control) TabContainerViewModel ViewModelBase View model base has an ObservableCollection of tabs type

Capture of Ctrl-X with the KeyDown event of a text box in WPF

I'm trying to trigger an event when the user presses ctrl-x using the KeyDown event. This works fine for ctrl-D but the event doesn't trigger when ctrl-x is pressed. I'm guessing this is because ctrl-x is the "cut" command. Is there any way to t

The data link in the user control does not work (WPF)

I have the following sample code in WPF. It is working well when I put the xaml and corresponding C# code inside windows, but when I am using a user control, the databinding doesn't work. why? Here is the code: User control XAML: <UserControl x:Class

Using DataTrigger in WPF

I have a TextBox control defined in XAML and I want to apply different background colors to the TextBox based on its IsReadOnly or IsEnabled properties. I used dataTriggers to actually switch between the colors as shown below: <Style x:Key="TextBo

Formatting the contents of a data grid

I have a wpf datagrid (.NET 4.0) that contains raw data from a database, and some of the fields need to be formatted to display in a meaningful manner, for example 3 fields containing Year / Month / Day could be formatted together to produce a proper

Open a WPF application from a click on a Windows button

Is it possible to open a WPF Application from a C# Windows button click event?You can launch it like any other applicaiton. Use the Process.Start method. If you need more control, you can create an instance of the Process class (Process process = new

WPF: Get Tabtitle from the Content (in the template)

I'm trying to display the Title of an Tabitem in his contentpresenter. Is there a possibility to get this name? For example in the Tabcontrol Template something like <Label> <ContentPresenter ContentSource="SelectedContentHeader" Grid.R

WPF: Stop a ContextMenu from Closing

A Context Menu automatically closes when the user clicks outside of it. Is there a way to stop it from closing ? I tried setting the StaysOpen property to true but failed to get the desired result. Thanks for any help!A bit unclear what you are tryin

DataBind to a text box in WPF

I'm completely new to databinding in WPF, and I'm trying to bind an object property to a textbox. My object is public class TestObj { private m_Limit; public string Limit { get { return m_Limit; } set { m_Limit = value; } } My XAML looks like <Window

Clear selection programmatically in WPF ComboBox

I have a ComboBox in WPF whose ItemsSource is set to a list programatically. How would I go about clearing the selection in an event handler? I've tried: comboBox.SelectedIndex = -1; comboBox.SelectedItem = null; comboBox.SelectedValue = null; comboB

hides the default resize handle in wpf

I have a borderless and transparent window in WPF, with some fancy decoration at the bottom. There's a custom footer with some non conventional curves and what not showing the company logo. This window needs to be resizable with a grip in the bottom