background preloader

.NET

Facebook Twitter

A WPF Custom Control for Zooming and Panning. Sample Code Introduction The main class, ZoomAndPanControl, is derived from the WPF ContentControl class. This means that the primary purpose of the control is to display content. In XAML, content controls are wrapped around other UI elements. For example, the content might be an image, a map or a chart. In this article, I use a Canvas as the content. This Canvas contains some colored rectangles that can be dragged about by the user. I'll present this article in two parts.

Screenshot This screenshot shows the data-binding sample. The large window with scrollbars is the viewport onto the content. The small overview window in the bottom left corner shows an overview of the entire content. Assumed Knowledge It is assumed that you already know C# and have a basic knowledge of using WPF and XAML. Background In my previous article, I alluded that I have been working on a flow-charting control. However I wanted the user to be able to zoom in and see more detail or zoom out to see an overview. An Extended WPF TabControl. Download source code - 46.64 KB Introduction I recently decided to have a go at changing the built-in WPF TabControl so that it behaves similar to the way in which Internet Explorer 7 works. The main area I wanted to change was the way in which the TabItems are arranged, currently the built-in TabControl will pack and stack items, so the more items there are, the more room is required for the headers, taking up space from the actual content of the TabItem.

With Internet Explorer 7, tabs remain on a single row and will scroll in and out of view. Properties/Events There are a few extra properties (Dependency Properties) and events added to the control. AllowAddNew - Setting this property to true will allow the end user to add new tabitems to the control via a button. If the above properties are set to true, there are three events that go with these properties. Finally, there are three extra properties of type Brush which are used for coloring the tabitems based on their state: Using the Code. WPF Tutorial : Layout-Panels-Containers & Layout Transformation. Download demo - 48.68 KB Table of Contents Introduction In my previous article, I discussed few basics of WPF applications, its architecture and internal structure to start with WPF. In this article of the series, I am going to discuss about the very basics of writing your first WPF application and how you can place controls in your window.

A Window While building your application, the first thing you notice is a Window. Non-Client Area: which displays the outer boundary of the window, that we normally see with any windows. Type of Window WPF window is of 3 types: Window: This is basically a normal windowed application, where every control is placed within the same window. In the above image, you can see how Normal Window differs from NavigationWindow. Let me discuss a bit on how you can use Pages in your application. Pages are created to be used as a Page for the Same Window. Hide Copy Code For further reference, you can use MSDN article: OverView of Navigation [^] Types of Containers GroupBox. Comment créer votre propre contrôle avec WPF.

Avec Windows Presentation Foundation, il existe 2 moyens, offerts aux développeurs, pour développer leurs propres contrôles. Tout d'abord, ils peuvent créer un contrôle utilisateur ("UserControl"). L'autre possibilité est d'hériter d'un contrôle déjà existant. Chacune de ces techniques possède ses avantages et ses inconvénients que nous allons détailler dans la suite de cet article. L'objectif est de vous permettre de faire le bon choix lorsque vous serez amené à vous poser la question de comment faire pour développer votre contrôle. Windows Presentation Foundation permet de créer ce que l'on appelle des contrôles utilisateur ("User Controls"). Si vous êtes développeur WindowsForms ou WebForms, cette notion ne doit pas vous être étrangère car c'est un mécanisme utilisé très souvent. Le but des contrôles utilisateur est de vous permettre de développer un contrôle qui est composé d'autres contrôles.

Avec WPF, il s'agit d'une technique tout à fait envisageable/utilisable dans vos projets. Pretty Cool Graphs In WPF « Sacha's blog. I have just finished writing up a new article for www.codeproject.com for which I will write another blog post about. Thing is, when I was looking into parts of that article I wanted to use some graphs in WPF, and had to have a hunt around to see what was out there. After a look about I found a truly excellent graphing library for WPF which is completely free. It’s a www.codeplex.com project called “GraphSharp” which is freely available at graphsharp.codeplex.com. I also figured it may be good to show people how to get up and running with GraphSharp in this standalone blog as the new article I published does absolutely no hand holding about the graph creation, as that was not really what the new article is about.

So how do we use GraphSharp then, well we need to do a couple of things 1. The 1st step is to define a custom Vertex for the graph such that you can store additional information for each Vertex. 2. 3. 4. 5. 6. 7. Putting it all together it looks like this: Like this: Threading Model. Consider the following example: This simple application counts upwards from three, searching for prime numbers. When the user clicks the Start button, the search begins. When the program finds a prime, it updates the user interface with its discovery. At any point, the user can stop the search.

Although simple enough, the prime number search could go on forever, which presents some difficulties. If we handled the entire search inside of the click event handler of the button, we would never give the UI thread a chance to handle other events. The UI would be unable to respond to input or process messages. We could conduct the prime number search in a separate thread, but then we would need to deal with synchronization issues. Microsoft Word accomplishes spell checking using this mechanism. The following example shows the XAML that creates the user interface.

The following example shows the code-behind. public void CheckNextNumber() { // Reset flag. Custom Provider Fundamentals. Microsoft Sync Framework includes providers for several synchronization scenarios such as file synchronization, but in some cases a custom provider is necessary. Custom providers require a developer to write more code than the providers that are included with Sync Framework, but they are a key component to the flexibility and extensibility of Sync Framework.

This topic provides information that helps you to understand custom providers and to make choices about which type of custom provider is appropriate for your application. If you are new to Sync Framework, we also recommend that you read "Sync Framework Components" in Selecting the Appropriate Sync Framework Components. Microsoft Sync Framework synchronizes replicas by using four basic components: the synchronization runtime, a synchronization session, and two synchronization providers.

When Sync Framework does not supply a provider for the data store to be synchronized, a custom provider must be written. Full Participant. Comment hacher une chaîne de caractères avec MD5 et C# ? - Blog de Ronald Vasseur. Bibliothèque de classes .NET Framework. Lazy Loading and the WPF Tree View Control – Matt Long (.com.au) I don’t even know what to say about this. September 24, 2012 at 8:17am0 notes September 22, 2012 at 7:59pm0 notes There’s a career out there for everyone.

September 13, 2012 at 11:47pm0 notes Dual Monitors!! (Taken with Instagram) My colleague Martin Magakian has open sourced some of the work he was doing for a project we’re currently working on. Check it out! .NET Framework 4. [C#] Activation protection.

Sync Framework