wpf

Unselect item from a ListBox so NotifyPropertyChanged is called when clicked

I have an ItemsControl with DataTemplates that contain ListBoxes with ItemsSource all bound to different ObservableCollections of the same type, each ListBox's SelectedItem is bound to the same property that raises PropertyChanged so that other visual elements of my UserControl will update with the SelectedItem's details. Everything wor...

Remebering State of Expand/Collapse of all the groups in ListView WPF

I have a ListView and implemented Grouping with the code below in XAML, <ListView.GroupStyle> <GroupStyle> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}"> <Setter Property="Margin" Value="0,...

What's your preferred approach to the sortable ObservableCollection in WPF?

This article "Write a Sortable ObservableCollection for WPF" appears to be all that's needed (for me) to handle any need to sort ObservableCollection. However, there might be scenarios that need a more complex design. Or, on the other extreme, there may be a way to prevent this need for a sort by design. Am I on the right track here or i...

Does the telerik RadGridView have an "IsDirty" Property

Is there any way to tell whether an ItemSource (e.g. a strongly typed List) for a RadGridView has been modified in anyway by RadGridView edit or delete operations? ...

WPF window changing the value of another window's control

I am new to WPF. I have a window that opens another window. This second window would like to change the opacity of a label in the first window. How can I control this value from another window? ...

WPF: How to bind a numeric property to DataGridTextColumn?

I thought it should be a simple thing for WPF, but I can't make it work... I have an int property (Divisions) on my class and I want to bind it to a DataGrid column. <DataGrid AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="Number of Divisions" Binding="{Binding Path=Divisions, StringFormat={...

Silverlight/WPF parenthetical value syntax in a Storyboard animation

Somehow in my WPF studies, this detail has escaped me. I've seen syntax of this sort: <UserControl.Resources> <Storyboard x:Name="myStoryboard"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" ... > ... Why is the StoryBoard.TargetProperty value surrounded by parentheses? What does that mea...

Grid row double click performs action on main window

This issue regarding WPF window (XAML application) I have a two windows one window getting launced from another window. Both window get into maximized state when gets open the child window which gets open has a grid on it and we have operation (double click on row click should close the window). Problem is happening that when we double...

How to change a mouse cursor shape for entire canvas?

I have WPF window with several textboxes, buttons, and canvas where I draw a graph. I would like to have cross cursor over the canvas, because this way user could point interesting area in more "scientific" way :-) Oddly, when I set cursor to cross for a canvas, it is still a standard arrow instead, but when the mouse is over any line o...

WPF buttons are outside the datacontext and could not be bound

Hello, I have 3 Buttons add,delete,open as RelayCommands in my DocumentViewModel. Below you see how I have bound them. Of course those binding does not work, because the data is set to the ItemsSource of the ListBox and the buttons are outside of that... What I tried then is to set the DataContext at the first StackPanel you see in my ...

WPF Windows program displays in large fonts but only on one PC

I have a WPF application rendering fonts to a larger size than I expect. The catch is that only WPF applications I write seem to have this effect, and the problem happens only on one computer. The effect also happens with all WPF programs I write (not just one), and all windows exhit the effect. I am using Visual Studio 2008 with .N...

multiple windows

Hi, I set up two Windows in my WPF C# Blend project. Now what I would like to know (and I have trouble finding some clear documentation) is how to run both windows on application startup and in what way I can pass code from window to window. Thanks ...

Newbie WPF Combo box question

I've got a newbie question about the combo box. The problem I'm having is with the selection changed event I'm binding to it. Here is my Code: <ComboBox Height="23" HorizontalAlignment="Left" Margin="12,67,0,0" Name="comboBox1" VerticalAlignment="Top" Width="1...

WPF distinguish between coding-SelectionChanged and the mouse-SelectionChanged.

Hi everyone! I have a machiavellian question (for me). In my WPF application I have a ListBox that has in the ItemTemplate a Combobox. When the user select a ComboBoxItem, I have to do some complex operations on the ObservableCollection that is the ItemsSource of the ListBox, then I have to show the ListBox with the changed data. The pro...

Bottom borders on WPF Grid

Hi everyone, I've got a pretty simple question regarding the WPF Grid Control. I'd like to set a bottom border on each row in the grid, but can only find how to put all 4 borders around each cell.. my code is quite simple <Grid Height="174" HorizontalAlignment="Left" Margin="23,289,0,0" Name="grid2" VerticalAlignment="Top" Width="730...

How do I record audio with C#/WPF?

I have an application to which I want to add the ability to import small audio snippets directly from a microphone device of some sort. I already allow importing of pictures and this works okay with disk files and cameras since cameras magically become disk devices when you attach them so a file import method works for both. Audio howe...

How do prevent a WPF text box inside a combo from reacting to right mouse clicks?

I creating a custonmized box class (inherits from ComboBox). I don't want the text box to react to right mouse clicks. I can get rid of the context menu by setting this to null in ApplyTemplate, but right mouse clicks move the cursor. I tried hooking up PreviewMouseRightButtonDown in ApplyTemplate and setting Handled to True, but the eve...

Is it appropriate to thrown an exception from CoerceValueCallback

Is it appropriate to throw an exception from a CoerceValueCallback if a given value is invalid or should only ValidateValueCallback be used for DP-value-validation? ...

Silverlight: Looking for an existing button control impl. that can be defined with different image per state.

I know I can do it myself but I figure someone must have implemented such a custom button control already. So is there an existing button control with dependency properties for defining an image per state? (Normal/Pressed/Hover/Disabled) (I've got couple of buttons that every button has its own set of images for the different states.)...

How to prevent a ListView from expanding the window dimension?

Hi, I put a ListView in the middle row of a View. The view is contained in a window that has SizeToContent set to WidthAndHeight. The ListView is initially empty, but the underlying ViewModel fills this list view in the process. The middle Grid.Row height is set to * to fill the available size of the window. When the ListView receives ...