wpf

WPF MVVM Focus Field on Load

I have a View that has a single textbox and a couple buttons below it. When the window loads I want that textbox to have focus. If I was not using MVVM I would just call TextBox.Focus() in the Loaded event. However my ViewModel does not know about my view so how can I accomplish this without putting code into the codebehind of my view?...

Paired ToggleButtons in WPF

I'm pretty sure someone will have done something like this before but have been hitting my head on this for a few days now, with little headway. I have a WPF form which is being used to compare trades. The trades differ on certain "break" fields. The form is to be used to select one "lead" trade and one of the remaining trades is select...

Simple non-fancy Windows application - should I start with WPF or WinForms?

Hello, I'm about to start developing a small Windows application using Microsoft Visual C# 2008 (Express edition). I'm very new to C# and .NET, so this is a newbie question. Should I start with WPF or should I stick with the old WinForms? My application has several screens, all having several text-boxes, check-boxes, combo-boxes, not ...

How can I access the ItemsPanel of a ListBox at runtime in silverlight?

How can I access the ItemsPanel of a ListBox at runtime in silverlight? ...

What's the Best Way to Catch the Return Key in a PasswordBox? (WPF/XAML)

What's the best way to catch the return key in a PasswordBox? (WPF/XAML) I have a TextBox field and a PasswordBox field on my login form (for username and password entry). I also have a login button which invokes the method that performs the login validation process. I need to make the Return key react the same way in the PasswordB...

How Do I Create a System.Windows.Media.ImageSource From a Byte Array?

How do I create a System.Windows.Media.ImageSource from a byte array? I have a byte array, containing the exact and complete file contents of a TIFF image file. I need to display this on the screen, and I have no idea where to even start. Supposedly, it can be done (according to my boss, our dev team has done it in the past, but no...

Setting a style on Control type not working

I'm writing a very basic WPF dialog and want to apply a simple style to all objects that inherit from the Control class. The code I'm using: <Window.Resources> <Style TargetType="{x:Type Control}"> <Setter Property="Margin" Value="20"/> </Style> </Window.Resources> <StackPanel> <TextBlock Text="some text"/> <Tex...

How to read installer shortcuts with C# (WPF)

Background: I've decided to teach myself C# through WPF, and I'm writing a small application that needs to get a list of Start Menu shortcuts and their targets and store them. Basically, I'm trying to take all the shortcuts and put their target applications' paths into memory. However, I've run into a problem trying to read Windows Insta...

How to send a WPF window to the back?

In my application I have a window I use for plotting debug data. When it loads, I would like to open it "in the background", behind all other windows. What's the best way to achieve this? ...

Where to find the nifty Textbox with the grayed out instruction?

While logging in to msn-messenger you have these nifty textboxes that show you what to type (username, password) in gray text. Once you start typing it disappears. This surely is not hard to implement using a user control in WPF, but is this control/behaviour already available? ...

WPF: Passing objects between UI Thread and Background thread

In my Window constructor after InitializeComponents, I need to create an object and bind it to a datagrid. Since the object creation is taking too much time, the windows takes a while to show up. So I decided to move the creation of the object to a background thread and "delegate back" to the UI thread by doing a dispatcher.invoke to per...

"inherit" style of theme in wpf

I'm using one of the themes in CodePlex and I want to add some modifications on the style but not to change their code. How can I inherit the theme style? ...

Drawing family trees with WPF

I'm searching for tutorials on how to draw a family tree with WPF (and C#). Something like http://www.myheritage.nl/FP/family-tree.php?s=65040841 or Family.Show but for a complete beginner. Family.Show is a bit too complex to start. I don't want to implement external controls but instead I want to learn how to write them myself. So I n...

What is the best WPF Graphing control?

Our latest project is using WPF for a rich client and we need a graphing tool that makes the best looking graphs that also has the ability to do the following with the graph: Line Graphs with the ability to add data points Hot spots on the graph that allows for interaction Ability to add new data on the fly and have the graph auto ref...

Making a generic loading animation in mvvm

i have a mvvm app that retrieve a lot of data from remote server. i wanna add an animation while data is being loaded what best way of doing that. ...

Adding item to tab control in VS 2008 WPF app

Adding item to tab control in VS 2008 WPF app I am bit of a newbie to WPF. I am using VS 2008 and working with a WPF app. With the design editor I add a Tab control and then add a new tab. I drop an item like a button onto the the tab control. But instead of actually being in the individual tab the item is almost modal on top of the c...

WPF Image Gallery

I'm going to be driving a touch-screen application (not a web app) that needs to present groups of images to users. The desire is to present a 3x3 grid of images with a page forward/backward capability. They can select a few and I'll present just those images. I don't see that ListView does quite what I want (although WPF is big enoug...

What is the best way to use a SSRS report viewer in a WPF application using MVVM

I have a WPF application using MVVM. I have some user controls that show some SSRS reports in a ReportViewer control hosted within a windows forms host control. The User Control has a simple combobox where the user selects a criteria and therefore the report satisfying this criteria will be loaded, its data fetched from the database and...

Should I continue learning C# with Windows Forms or WPF Applications?

I am starting to learn c# and wanted to create an actual app which one of the two would you start with? ...

Implementing a simple Master-Detail scenario for WPF in MVVM

I have a WPF application using MVVM. I have some user controls that should show a Person FirstName, LastName and email in 3 Textbox controls using simple databinding. The User Control has a simple combobox where the user selects the ID for the user and therefore the Person Record with that ID should be loaded (its data fetched from the ...