wpf

Generic View-Model Editing Support

I have an abstract generic view-model that I use as a base-class for several other view-models. It is defined as follows: public abstract class DiscreteViewModel<T> { protected DiscreteItem<T> _selectedItem; ... } My DiscreteItem class is also generic, and as follows: public class DiscreteItem<T> { public T Display { get;...

Detecting the user pressing F10 in WPF

My WPF application has behaviour triggered by the functions keys (F1-F12). My code is along these lines: private void Window_KeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.F1: ... case Key.F2: ... } } This works for all F-keys except F10. Debugging, I find that e.Key == ...

What is the standard way to constantly check SQL Server connection?

In a WPF application I use LINQ to SQL queries inside try - catch constructions to process exceptions, in case there is something wrong with DB server connection. The problem is - I have some queries executing on a timer-polling basis. So, if connection fails, I have numerous long queries attempts and UI is freezing. What is the stand...

Quirks of Visual Studio's property pane with WPF

Working in the visual designer of a WinForm project, when one selects an element the properties pane lists all the properties for that element. Selecting a property in the properties pane then displays a description for that property (the value of the assigned DescriptionAttribute) in a property description box immediately below the list...

WPF Groupbox header postion alignment

Is it possible to set the position alignment for a groupbox header in WPF? the default is to place in the top left corner of the groupbox outline but I would like it to be centered at the top. I know that you can set the properties of the text using: <GroupBox Grid.Row="1" HorizontalAlignment="Center"> <GroupBox.Header> <TextB...

How can I get the size of a WPF panel that was changed during runtime?

I have a panel that's width can be resized during runtime <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="770*"/> </Grid.ColumnDefinitions> <panels:NavigationPanel x:Name="cmBar" Margin="2,2,0,2" HorizontalAlignment="Left" Width="220"/> <panels:DetailAreaPanel x:Name="detailGrid" ...

Problem with FIPS Validated Cryptographic Algorithms

Hello All, I am running Visual Studio 2008 Version 9.0.30729.1 SP with .NET 3.5 SP 1 under Windows XP Pro Version 2002 SP 3 with an Intel Core 2 Duo E8400 3 GHz processor. I am developing a C# WPF application that uses the Microsoft Patterns & Practices group's Composite Application Library (CAL). I am getting the following compliatio...

Updating an ObservableCollection in a separate thread

In a WPF application an ObservableCollection is filled and updated by LINQ to SQL queries. Then UI objects are updated using values from this ObservableCollection. Is it possible and reasonable that operations of updating this ObservableCollection by LINQ to SQL queries were executed in a separate thread? If yes, will, in this case, i...

How do I specify Command on Button when I'm using a Template in WPF?

I have a Button template to define what my edit button should look like: <ControlTemplate x:Key="EditButton" TargetType="{x:Type Button}"> <Button Style="{StaticResource GrayOutButtonStyle}" > <Image x:Name="editImage" Source="{StaticResource EditIcon}" /> </Button> </ControlTemplate> I want to declare the Command in...

I'm in MVVM ViewModel hell

So far, I am really happy with the way things have gone in my app's transition from typical click event handlers everywhere, to complete GUI decoupling. Now I'm running into something I can't quite figure out, and it's related to a window that I want my GUI to pop up, and it needs to display information from the model. I guess the shor...

WPF Startup Screen like Blend

Our main WPF window ('Main Window') takes considerable time to create (it is using a ribbon and docking panel similar to Visual Studio). Just like in Blend the first action will always be to either choose an existing project to work on or to create a new project. Therefore we would like to show this 'Select Project' window as quickly as ...

Tree Collection in .NET

When I make a list box in WPF I frequently set its ItemsSource to be a List. Is there a Tree for TreeView (or what goes in ItemsSource for TreeView)? Is there a collection or generally accepted method for handling tree data in C#.NET? ...

Asynchronously call CollectionView.MoveCurrentToFirst?

Asynchronously call CollectionView.MoveCurrentToFirst? ...

WPF. Catch last window click anywhere

Is there anyway that a class can catch the last click in the application? Something like public class MyClickManagerClass { public MyClickManagerClass() { // subscribe to a global click event } private void GlobalClickEventHandler(object sender, EventArgs e) { // do something with the click here ...

WPF advice on XML data binding: XmlDataPresenter vs custom class?

Hello there, I'm just starting out in WPF and I'm building a simple movie library as a test project to help me find my feet. I'm storing my movie information in XML, for example: <movie id="1" title="Back To The Future" date="1985" ... /> The movies appear in a list and when clicked the fields will become editable. I've got that w...

WPF - Good Way to take a list to a Tree

I have a list that looks like this: Base/Level1/Item1 Base/Level1/Item2 Base/Level1/Sub1/Item1 Base/Level2/Item1 Base/Level3/Sub1/Item1 I would like an easy way put that into a ListView. (Ie similar to this) Base | +->Level1 | | | +=Item1 | +=Item2 | | | +->Sub1 | | | +=Item1 | +-...

Visual Studio 2008, WPF Tabitem. How do I bring it to front?

Hello there, I cannot figure out how to bring a tabitem to the front of a tabcontrol in a visual studio 2008 wpf project so that I can see the controls I'm editing. The visual display part only ever shows the controls on the first tabitem. It does works in run time, just not in design time. Sounds retarded, maybe I am, but I can't f...

UI Threading with ViewModels

Collections that are bound in a WPF View must be updated on the UI thread. ViewModel exposes a collection Therefore when collection in the ViewModel is modified it must be done in the UI thread Best practice is to keep ViewModels ignorant of View and presumably such details as Dispatcher. What is the cleanest way to resolve this whil...

Make combobox unselectable? or better UI?

This may seem strange... but I'm wondering if there is anyway to make a combobox non selectable. So it displays as normal, except cannot be selected. I have 3 buttons underneath it, Edit, Cancel, Save. (Cancel + save obviously not enabled) The plan is so when user hits edit, they can change the items in the combo box. I know .IsEnabled...

WPF Datagrid : Programatically bringing a column into view (horizontal scroll)

I would like to bring a column into view programatically. I have a lot of columns and when they are off screen i would like to select a cell and bring that cell into view, i can select a cell that is off screen and when i horizontal scroll to bring the cell visible the cell is selected. i know you can do this with the rows, i.e Scroll...