wpf

starting with an empty DataContext on a popup

I have a popup that is bound at runtime to elements of a chart. The bindings are defined in XAML. When the application starts, I am getting many errors in the Immediate Window because the XAML bindings aren't valid (by design). I need a way to disable binding on this popup until I am about to display it during a mouseover event (in co...

Autotab in WPF ComboBox in c#

How do I implement autotab (automatically tabbing to the next field when a field is filled) in a WPF ComboBox in c#? ...

Why Does ItemsControl Not Use My ItemTemplate?

I am able to use an ItemTemplate within an ItemsControl to render items in a specific format. However, if one of the items within the ItemsControl happens to be, say, a TextBox, that TextBox is rendered rather than an instance of the ItemsTemplate. From what I can tell, this is true for any FrameworkElement. Is this intended behavior ...

Using WPF expander control on microsoft surface platform

I am trying to use the Expander control in the surface application. I have seen its not a surface control so application compiles and control shows up but the contacts are not working. Is there anyway I can modify the contact events and make it work in surface applications. ...

How to make WPF DataGridCell ReadOnly?

I understand you can make the whole DataGrid or a whole column readyonly (IsReadOnly = true). However, at cell level this property is ready only. But I do need this level of granularity. There is blog about adding IsReadOnly to a row by changing the source code in old days when DataGrid was public domain, but now I don't have source code...

WPF DataGrid: Disallow multiple row highlighting

How can I make the data grid not allow the user to select multiple rows? ...

How to Disable Tab functionality inside a grid in WPF

Hi, My requirement is rather a tricky one (it seems to me). I will explain the scenario. I have a DataGrid. In the DataGrid, I have two columns in which I have a grid in every cell of these two columns, inside of which, there are two comboboxes - the purpose being to switch the visibility based on some conditions. When we select a val...

Is there any free ilmerge like tool out there which can merge wpf assemblies?

Hi! I'm looking for a free tool to merge all of my wpf application's assemblies into a single assembly. Usually, I use ILMerge, but unfortunately, it does not support merging WPF assemblies. Are there any tools out there which can achieve that? A commercial tool is not an option for me because the application is an open source project....

How to get cell level ComboBox for WPF DataGrid?

It looks WFP DataGridComboBoxColumn is using a single ItemsSource for all cells in this column. I have a case where the ComboBox items are dependent on the other cell in the same row. I managed to populate the ItemsSource in PreparingCellForEdit event. However, it doesn't work as desired. Initially, all cells in this column is empty. Onc...

WPF: Is there a "ListBox" without the ability to select items?

Basically I want something like the old VB 6 DataRepeater, where every item in a collection is bound to a template. The only feature I want the container to have is scrolling and data-binding, the other stuff like being able to select items just gets in the way. P.S. If you can't recommend anything I'm just going to use a stack panel an...

How do I get the value of the Text property when validating a WPF ComboBox.SelectedItem

I am using a ComboBox with IsEditable set to true filled with Employee entities. Typing a valid employee name will select that employee from the list but if a name is typed that doesn't exist in the list, there's no indication that SelectedItem is null. To get around this I have created a simple validation rule on the SelectedItem bindin...

ListBox is selecting many items even in SelectionMode="Single"

I have encountered something very strange, simple WPF application <Window x:Class="ListBoxSelection.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ListBox ItemsSou...

How can I bind against the Index of a ListBoxItem

I'd like to bind the z index of list box items to their index. Ideally, we would have Style TargetType='{x:Type ListBoxItem}'> Setter Property='Panel.ZIndex' Value='{Binding RelativeSource={RelativeSource Self}, Path=-Index} /> ... However, the list box item does not have an index property. I can think of a number of crazy solutio...

Checkbox gets reset in WPF Datagrid when sorting

I have a WPF application with DataGrid The DataGrid contains 4 columns with a checkbox template column on the first column the problem is when i check some of the checkbox on the items, the checkbox would got reset when i sort a certain column. For example i check the checkbox on the row 2 it gets unchecked when i sort the datagrid. be...

How to make WPF DataGrid scrollbar cover the non-scrollable area as well?

I'm not sure if this is just my machine (WinXP SP3), because I have not seen it in other people's screenshots. It looks to me that the scrollbars in DataGrid only cover the scrollable area. That means, the column and row header areas and the bottom right corner are shown in background color, which looks ugly to me. How can I make the sc...

C# winforms code to c# wpf code

Hi, I have a drawing application developed in winforms C# which uses many System.Drawing.Bitmap object throughout the code. Now I am writing it into WPF with c#. I have done almost 90% of the conversion. Coming to the problem... I have the following code which is used to traverse the image pixel by pixel Bitmap result = new Bitmap(im...

wpf usercontrol showdialog problem

There is a MainWindow,a usercontrol which is located in my MainWindow and a OtherForm which i am going to show from usercontrol. I sent OtherForm as parameter from MainWindow to usercontrol.And in usercontrol i am calling OtherForm.showdialog.When i show it second time ,i am getting "Cannot set Visibility or call Show, ShowDialog, or Wi...

Can I insert a Window into another Window?

I have two Window (name: window1 \ window2) whether it is possible to insert them in another Window (window3). What would have once been seen window1 \ window2, buyout lie window3? ...

Control events into commands and RX

Hi We have some WPF/Silverlight controls we have written using the traditional event architecture (no commands etc.), and want to convert it to MVVM compliant ones. I researched on this subject, and i take it i will have to write commands to wrap the events that i currently have in the control. I would like to design it correctly now so...

wpf datagrid and data binding

I want a simple sample data binding for wpf data grid. (not using dataset use list or other collections). just Xaml codes and a little code behind. Is there any simple frame work for MVVM? ...