Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Team Bloggers

Browse by Tags

All Tags » .net 3.5 » Avalon   (RSS)

  • Clipping of child elements

    On the forums I saw this interesting problem where there was a need to round the corners of a stackpanel inside a border with cornerradius set... The top is what you get and the bottom image is what you want. The simplest thing to do here is to set the padding on the border so that the stackpanel doesnt bleed around the corners. But when that doesnt meet your requirements you will need to set the clip property on the child in the OnRender function so that you get the correct clipping. The code for the above is attached .(thanks to Ifeanyi) Share this post Read More...
  • Split Button\Menu Item\Automation

    I got a couple of queries from the readers asking if I could provide a slightly non-trivial sample of using automation. So I created a split button user control which looks something like this If there are no items then you get a checkable button. The items are created in a popup and are generated on demand. This makes the automation a bit interesting. As you can see the control supports 3 patterns – · Invoke (for the button) · ExpandCollapse (for the drop down) · Toggle (for the checkable option) – This is just for demo purposes You will need to specify this in the GetPattern function which overrides the one in the base AutomationPeer. The other function that you might want to override is GetChildrenCore in case of popups. The default behavior is to go through the visual tree and get the children. However, popups are in a separate visual tree. The sample overrides the function since the items are displayed as part of a popup J Also for each of the patterns, it is necessary that we implement Read More...
  • Xbaps using Cookies

    Earlier on I had written an app, BlogPadm which was fulltrust and the writer used Google Data API to write the content to Blogger.com. However, when you create an xbap version of it, a problem arises in that you cannot make WebRequests outside site of origin and hence, the xbap version of the above failed to take off. The workaround is to create a webservice at the site of origin so that the calls are forwarded. However, the focus of this app was to test cookies. So I hosted a blog server and had the blogwriter at the site of origin. So the flow is something like this: http://MainSite/Login.aspx à http://blogsite/blogwriter.xbap à http://blogsite/postentry.aspx The communication between the asp pages and the xbap is through cookies. Code for this application is attached. Note that this project makes use of servers and hence, the app won’t run on execution since the server code is now on the local machine. The Blog engine used is the BlogEngine.net which is an open source blog server. The Read More...
  • Another MindMapping Tool

    A month ago, I was browsing through different blogs and came across Denis Vuyka's blog post on connecting objects on the canvas... Nice post... Being an avid fan of mind maps, that was the natural extension to the library that he created. Check it out There are 3 types of objects which are basically the same... they contain rich content... Right clicking on the objects opens up an editable Richtextbox... In case you paste in Links, you can click them (Ctrl + Click) ... This opens the link in a new browser window. Maps can be saved/opened. Notice that saving a file also creates a folder with multiple streams. Ideally, everything would be zipped into a single file., I have left this upto you guys :) ... The reason for these multiple streams is the presence of images in Richtextboxes. A simple XamlWriter.Save saves only the image links and not the image. As such, the richtextboxes are saved in the xamlpackage format and picked up on opening the file.... Source code is attached so that you Read More...
  • MindMap app using Hyperbolic tree

    I recently came across a Hyperbolic tree implementation on codeplex using WPF and thought that a nice usage of it could be in writing a mind map creating application.... I tweaked some of the original code and got a tree with editable nodes... Its been laying around for sometime, so I thought it best to put it out there so that you folks can continue its development. Though its not functional in the true sense, it does provide the basic functionality like saving and opening (albeit to the same file)... Currently only the text is serialized... The project (VS 2008) is attached Note that the usage of the Hyperbolic tree and its code is under the Codeplex License terms Share this post Read More...
  • .NET Source code

    Now thats what I call WOW ... For .NET developers this is like getting hold of the holy grail :) ... " We'll begin by offering the source code (with source file comments included) for the .NET Base Class Libraries (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc), ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows). We'll then be adding more libraries in the months ahead (including WCF, Workflow, and LINQ). The source code will be released under the Microsoft Reference License (MS-RL). You'll be able to download the .NET Framework source libraries via a standalone install (allowing you to use any text editor to browse it locally). We will also provide integrated debugging support of it within VS 2008. " Read the complete post at Scott's blog Share this post Read More...
  • Testing using WPF UI automation

    One question that often pops up among WPF app developers is UI testing... WPF enables this scenario through a new accessibility framework. Some useful resources from mdeavey's post Overview Using UI Automation UI Spy Stress Test using UI Automation Unit Testing WPF controls with Automation Peers Instantiating a WPF control from an NUnit test Adding UI Automation support to a custom control .NET UI Automation Extension for Automation Testing Share this post Read More...
  • 3.5 features: Viewport2DVisual3D

    Viewport2DVisual3D .... this new feature makes things a lot easier in the 3D world.. What this enables is putting interactive 2D on 3D. This makes things like having a textbox in 3D a breeze... < Viewport2DVisual3D x:Name = " vp2d_multiple_children " Geometry = " {StaticResource mesh} " > < Viewport2DVisual3D.Material > < DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial = " True " Brush = " White " /> </ Viewport2DVisual3D.Material > <TextBox /> </ Viewport2DVisual3D > One other thing is mapping 3D points to 2D is so much more easier... Earlier on I had a post on mapping a mouseclick on a 3d model to a 2d coordinate. This involved using some barycentric coordinates and such... Now all you need is call e.GetPosition(relativeTo) in the mouse event handler... tada!!... your coordinates are ready... so using this new stuff i created a simple app for keeping track of your travels. right clicking on the globe puts a tag on the globe. Clicking on the Read More...
  • 3.5 Features: Enabled hyperlinks in RichTextBox

    hmmm... that was one often requested feature. So to enable hyperlinks in RichTextBox all that is needed is to set the property IsDocumentEnabled on the RichTextBox. Type the following in XamlPadX and you have the hyperlink navigation working. < RichTextBox IsDocumentEnabled = " True " xmlns = ' http://schemas.microsoft.com/winfx/2006/xaml/presentation ' xmlns:x = ' http://schemas.microsoft.com/winfx/2006/xaml ' > < FlowDocument > < Paragraph > < Hyperlink NavigateUri = " http://club.live.com " > Live Games </ Hyperlink > </ Paragraph > </ FlowDocument > </ RichTextBox > A couple of things to notice here: 1> The Navigation is possible only on a Ctrl Click operation 2> There is no tooltip to indicate that navigation is possible. You could add this to the Hyperlink. A simpler alternative is to just subclass the Hyperlink and add the tooltip in the constructor public class MyHyperlink : Hyperlink { public MyHyperlink() { this .ToolTip = Read More...
  • 3.5 features: Filtering text with IME languages

    So 3.5 beta2 is out and it has quite a lot of features. So one of them is the filtering mechanism for IME languages. This was not a problem in the english and other non-IME languages. The problems were the events associated with IME input - TextInputStart/Update/input... A major concern was that it was not possible to determine where the composition took place. Now all these issues have been fixed and filtering in these languages is a breeze. I came up with a sample calculator with the filtered IME textbox which shows how the filtering is done for IME languages. If you go through the code, you will notice that min max positions of the composition are tracked in the events to determine the correct caret position after the filter is applied. The textbox takes any ime input and filters the characters after the composition is complete. The sample project is included to demonstrate the usage of the events. The project also includes a filtered richtextbox even though its not used in the demo Read More...
  • 3.5 released with many features!!!

    You can now download Visual studio 2008 Beta2 and .Net 3.5 Beta 2. The link is here So whats new in 3.5 - Support for Addins - Xbaps now run in FoerFox - Cookies can be shared between XBAP's and Web Apps - Better support for binding to BindingList coll and LINQ - new UIElement3D, ContainerUIElement3D, ModelUIElement3D classes which make 3D stuff easy - Place 2D elements on 3D using Viewport2DVisual3D - RichTextBox has embedded elements enabled (IsDocumentEnabled property) - IME support has improved. Filtering text in IME is now a well suported scenario - and many other features... btw, i'll try posting a few samples with these bits in a few days :) Share this post Read More...

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us