wpf

WPF access DataGrid row element

Hello, I've a got strange situation. I've got a datagrid, and in one of the columns is a datepicker and checkbox. The checkbox if selected will disable the datepicker. ***************************** * | * * DatePicker | Checkbox * * | * ***************************** I've had a stab at thi...

WPF:Setting background of panel with custom color code

IN WPF,I can set the background of a stack panel using the below code stackPanelFlasher .Background =Brushes.Aqua How can i set the color as a hex color code (ex :#C7DFFC) ? ...

WPF Treeview HierarchicalDataTemplate MTM Relation

I am trying to map a TreeView to a collection using the HierarchicalDataTemplate. The collection contains an Object that contains child entities of itself(Many To Many Relation), and then goes down to another object using regular one to many relation. I use the followings: <HierarchicalDataTemplate DataType="{x:Type src:Organization}" I...

WPF 4.0 TreeViewItem.Expanded called recursively for parents of the expanded node

Has anyone got any idea why in WPF .NET 4 the treeview TreeViewItem.Expanded event is call by the expanded node, then by each of the parents recursively up the tree until and including the root node? I can get around it but I'd just like to know the mechanics of the problem. Ed ...

Wait for WPF app to load after starting with Process.Start()

I have a WinForms app that starts a wpf process running using Process.Start. I would like to know when the WPF process is finished loading and I can access the process.MainWindowHandle property (its 0 before its completly loaded). I tried polling but the handle is always 0. However, if I debug and wait (after Process.Start) for the ...

How do I bind an inherited attached property value to my VM?

I have defined a custom attached property as follows: public class DataFilter { public static readonly DependencyProperty FilterColumnProperty = DependencyProperty.RegisterAttached("FilterColumn", typeof (string), typeof (DataFilter), new FrameworkPropertyMetadata(string.Empty, ...

Open source backgammon in VB.NET/C#/WPF

I'm looking for sample source for backgammon in VB.NET or C#, preferably using WPF. What existing open source projects implement backgammon? ...

Is there a xamly way to populate StaticResource at runtime?

I would actually prefer using a DynamicResource in this context, but it's impossible: <Page.Resources> <CollectionViewSource x:Key="CategoriesCollection" Source="{Binding Context.CatsList, Source={x:Static Application.Current}}"/> <DataGridComboBoxColumn Header="Category" ItemsSource="{Binding Source={StaticResource Cate...

The scrollbar of a ListBox disappears in WPF in certain configurations

I have managed to reproduce a weird behavior in the auto scrollviewer functionality of a listbox when it is placed in a 2*2 grid. If you try to use the following xaml as it is you will see that the vertical scrollviewer is there but not visible (it just exceeds the width of the first column) <Window x:Class="WpfApplication1.Window1" ...

How can I set the XAML for the first WPF RadioButton in a ListView control to be checked by default?

I have a WPF ListView control containing a number of RadioButton controls using data binding. I'd like the first RadioButton in the group to be checked by default, preferably set in the XAML rather than programmatically, but haven't managed to achieve this. My XAML for the control is: <ListView ItemsSource="{Binding OptionsSor...

Control in an ItemTemplate of a ComboBox loses its binding

I have a ComboBox that uses an ItemTemplate as shown below. Somehow the Text property of the text box defined in the item template gets disconnected from the binding and stops being updated when the selected item changes. The ComboBox.ItemsSource is bound to a DependencyProperty that is list of CatheterDefinition objects. The ComboBox...

Code to check if a cell of a DataGrid is currently edited

Is there a simple possibility to check if the DataGrid is currently in EditMode (Without to subscribe to BeginningEdit and CellEditEnding) ...

accepting last field on a WPF window

HI: How can I accept the last field entered when the window closes? could be a chkbox or textbox or ... Thanks ...

Inserting columns into a Table

Hello, I have a table with 3 columns. Now I want to insert another column, but I want to insert the new column after the first one. Now I'm wondering how this can be done. If I'm not wrong, the Table.Columns property isn't really representing columns, it's more representing their layout but has nothing to do with the values of the colum...

Binding the IsSelectedProperty of a ListBox in WPF is not working. Need Help

I am trying to do something that should be brain-dead simple, however, I cannot get it to work. I am displaying a list of items in a listbox. I have added check boxes to the list box so that the user can select multiple items. However, even though the object in the list being bound to the ListBox has an "IsSelected" property, it is not b...

WPF Merge ItemsSource Lists

I am working with a 2 lists in a backend class. Each list is a different type. Would like to present the user with a single list (containing a union of both lists) of which when an item in this list is selected the item's details appear. The code will look something like: My backend class looks somethings like this public ObservableC...

How to dynamically collapse a WPF element such as Border when it has no child element?

I have found the need to collapse a given WPF element or control when it is visually empty and I'm curious whether others have come across this and if so what type of solutions have worked. My current case is one where I have a Border control that either will have a child element or not depending on various cases. When Border.Child is n...

How can I make a PriorityBinding fail if the value returned is Null?

I have a PriorityBinding <PriorityBinding FallbackValue="Bindings were null"> <Binding Path="Foo" /> <Binding Path="Bar" /> </PriorityBinding> I'd like to make it so if Foo is null it will use Bar and if both are null it will use the FallbackValue. However null is a valid value for this property because it only expects an obj...

Pattern / methodology for communication between Windows and/or UserControls

Hello: I'm currently developing a application where I will have multiple windows open using C# and WPF. Is there a pattern or common methodology used to help faciliate communication between open Windows or/and UserControls? For example, a window, let's call it the 'Hierarchy Window', may displays a hierarchy of countries, provinces,...

WPF executable won't run outside of Visual Studio (resource dictionary issue)

I have a WPF app that works beautifully if I "debug" (F5) in Visual Studio (Debug and Release mode both work), but if I try to double-click the .exe in the bin\Release folder, Windows kills the application immediately. The problem appears to be that the executable can't find "PresentationFramework.Aero", which I added to my App's resour...