background preloader

WPF

Facebook Twitter

WPF coding mutually exclusive Check Boxes with Data Binding. Home > C#, Programming, WPF > WPF coding mutually exclusive Check Boxes with Data Binding Last week I was coding a View that required for me to show two ChekBox controls which were mutually exclusive in the same way that two or more RadioButton controls that belong to the same group would interact.

WPF coding mutually exclusive Check Boxes with Data Binding

My problem was that one Boolean property which came from a bit column in the database needed to drive which CheckBox would be checked: “Yes” or “No”. In this example I attempt to show how to code two mutually exclusive checkboxes while binding to the Boolean property described above: Tetris C# WPF Tutorial Teil 1. WPF Tutorial. WPF: Animations in XAML and code-behind. WPF makes it very easy to define animations, by using timelines, storyboards and dependency properties.

WPF: Animations in XAML and code-behind

Here are a few simple examples and explanations. Additionally, you will find resources to download on the bottom of this article. For example, let's consider the following TextBlock: TextBlock definition This simply renders the text "Hello world", with a rotation of 0°. Note also that if you want to define more than one transformation for an object, you must include them in a TransformGroup, which comes between the TextBlock.RenderTransform and the RotateTransform (plus the other tranformations). Animation triggered in the XAML code The usual way to start animations in XAML is by using triggers. Animation triggered by a click What did we do here?

The animation itself is not too difficult to understand either: We define the target object of the animation, which is our label lblHello.

TreeView

MVVM. WPF/MVVM Quick Start Tutorial. Introduction Assuming that you have a decent understanding of C#, getting started in WPF isn't too difficult.

WPF/MVVM Quick Start Tutorial

I started looking at WPF a while ago, and didn't find many helpful MVVM tutorials. Hopefully this article addresses that. As with learning any new technology, you get the benefit of hindsight. From my perspective, almost every tutorial on WPF I've come across is inadequate for one of several reasons: The example is all in XAML. So to address this, I've written this based on what I would have liked to have found as the #1 hit on Google after typing 'WPF Tutorial'. I will quickly introduce some topics, then show an example that explains or demonstrates each point. As this tutorial is quite long, I've elided quite a lot of code for brevity, so please download the attached zip file, and look at the examples (.NET 4.0/VS2010).

PRISM

WPF Application Framework (WAF) Walkthrough: Hosting a 3-D WPF Composite Control in Windows Forms. Tasks illustrated in this walkthrough include: For a complete code listing of the tasks illustrated in this walkthrough, see Hosting a 3-D WPF Composite Control in Windows Forms Sample.

Walkthrough: Hosting a 3-D WPF Composite Control in Windows Forms

You need the following components to complete this walkthrough: Visual Studio 2008. Migration and Interoperability. Host WPF Controls in Windows Forms. Using .NET Controls in VB6. Introduction Recently, a customer asked if it would be possible to add some specific functionality to a program written by us.

Using .NET Controls in VB6

The program in question displayed the forces and streamed in real-time, acting on the various axles of a racing car. The version at the time simply had a PictureBox control in VB6 with text boxes, etc. positioned around the picture to display the values. The customer was requesting that this whole "picture" be scaled depending on the size of the window, so that on large screens it would be easier to read. The problem Put quite simply, the language in which the application was written, VB6, does not provide very good support for graphics. The solution The timeframe for implementing the solution was limited, so although not completely out of the question, a complete re-write of the software in VB.NET was not really feasible.

Stage 1: creating the control Create a new Windows Control Library project from within Visual Studio. Properties regasm.exe Assembly.dll Summary. Can I create a ActiveX Control from a WPF UserControl and use in a non CLI C++ application. Walkthrough: Hosting WPF Content in Win32. The code to host the WPF content is implemented in a handler for the WM_CREATE notification on the host window. case WM_CREATE : GetClientRect(hWnd, &rect); wpfHwnd = GetHwnd(hWnd, rect.right-375, 0, 375, 250); CreateDataDisplay(hWnd, 275, rect.right-375, 375); CreateRadioButtons(hWnd); break; The GetHwnd method takes size and position information plus the parent window handle and returns the window handle of the hosted WPF content.

Walkthrough: Hosting WPF Content in Win32

You next create an instance of the WPF content object. In this case, the WPF content is implemented as a separate class, WPFPage, using C++/CLI. You could also implement the WPF content with XAML.