Lester's WPF\SL Blog


Simple, Easy & Beautiful


 

Blog - Post Feedback Form(CAPTCHA)
  • Lester's WPF\Silverlight Blog

    Part III: Non-Rectangular Window in WPF (use of Thumb)

    • 0 Comments
    There seemed to be quite a lot of interest in my previous post on non-rectangular spash screen and I also received a lot of requests to post code to move around such a window. The magic to this is to use a thumb and then use the dragdelta event. The code would look something like this: void b_Click( object sender, RoutedEventArgs e) { HwndSourceParameters sParams = new HwndSourceParameters ( "Layered window" , 200, 200); sParams.UsesPerPixelOpacity = true ; _source = new HwndSource (sParams); _source.Disposed += new EventHandler (_source_Disposed); Thumb t = new Thumb (); t.Height = 200; t.Width = 200; t.DragDelta += MoveImage; Image vista = new Image (); vista.Margin = new Thickness (0); BitmapImage bi = new BitmapImage (); bi.BeginInit...
  • Lester's WPF\Silverlight Blog

    Part I :Traffic Alert App - Take the pain out of driving

    • 2 Comments
    In the past few weeks I have creating some sample apps and in the next few weeks wou will get to see them. The first app is called TrafficAlert. Now as the name says it alerts you about traffic conditions. I have always had this problem of analyzing traffic maps because they show so many red, yellow green spots that its hard to get the details easily. So this app tries to do away with the analysis of the traffic maps. Rather it is one level higher and it provides a list view of the traffic conditions grouped as highways. Consequently you get a better perspective and hence, you can plan your driving route much more easily. Before talking anything more lets just have a look. This makes things a lot easier than explaining. :) . Now that we have...
  • Lester's WPF\Silverlight Blog

    Using WPF for creating gadgets/desktop apps

    • 2 Comments
    In the June CTP we have the AllowsTransparency property made available at the Window level. This takes away lot of pain from using HwndSources. It makes life a lot easeir since all that is needed is to set the properties: AllowsTransparency="true" Background="transparent" and WindowStyle="none". As in the case of HwndSource this would remove the title bar and to provide the drag functionality we would have to use a Thumb. I tried putting these new properties to good use by creating a simple gadget ( more of a desktop app) which is just eye candy :).... So its a rotating globe... which has a circular thumb for dragging it along and the ever so useful Close button. And yeah there is no minimized button; thats by design :) couldnt resist...
  • Lester's WPF\Silverlight Blog

    Lawson Client - Great looking WPF enterprise app

    • 4 Comments
    I just came across this post from LongZheng that highlights the usage of WPF for creating visually enticing enterprise apps. aint that really nice... read the full post here Share this post
  • Lester's WPF\Silverlight Blog

    Using RibbonGallery Control

    • 6 Comments
    The Ribbon Control is a pretty big control owing to the complexity of the Ribbon design guidelines. You can give it a try by downloading from LINK While there are several things to blog about, this post will focus on RibbonGallery. The download provides a sample that covers all features by implementing the Office Ribbon. This post will trim the sample to focus specifically on the RibbonGallery usage To whet our appetite, the dropdown of both the controls are RibbonGallery controls The gallery can be hosted in the following Ribbon Controls: § RibbonMenuButton § RibbonSplitButton § RibbonComboBox § RibbonMenuItem § RibbonSplitMenuItem § RibbonApplicationMenuItem § RibbonApplicationSplitMenuItem...
  • Lester's WPF\Silverlight Blog

    New WPF Features: Binding to Dynamic Objects

    • 0 Comments
    This is part of a series on New WPF Features C# 4.0 allows creation of dynamic objects which is useful when you are interacting with dynamic languages. If you are unfamiliar with the dynamic concept take a quick look at this blog entry So back to WPF. We support binding to dynamic objects.. woohoo... To begin with you need to create the dynamic object (see attached proj ) < Window.Resources > < local : DynamicObjectClass x : Key ="MyDynamicObject" /> </ Window.Resources > < StackPanel Name ="BindPanel" DataContext ="{ StaticResource MyDynamicObject }" > < TextBox Text ="{ Binding Path =A}"/> < TextBlock Text ="{ Binding Path =B.C}" /> < TextBox Text ="{ Binding Path =[(x:Int32...
  • Lester's WPF\Silverlight Blog

    3.5 features: Viewport2DVisual3D

    • 9 Comments
    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....
  • Lester's WPF\Silverlight Blog

    Collapsing animation in WPF

    • 2 Comments
    its been some time since my last post.. so to get things going heres some simple animation code which collapses objects and the one above takes its place (something on the lines of tetrix :) ) .. the main part of this code is a small snippet which I came across some time ago (written by Bob Shogren) <EventTrigger RoutedEvent="Mouse.PreviewMouseDown"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty = "Opacity" To = "0" BeginTime = "0:0:0" Duration = "0:0:2" /> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty = "Visibility "> <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="{x:Static Visibility.Collapsed}" /> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard>...
  • Lester's WPF\Silverlight Blog

    WPF Touch Basics

    • 1 Comments
    In my previous posts, I briefly described the new WPF Touch feature. Was planning to get a more detailed post out but just couldnt get the time. Thankfully, Drake Campbell, one of our devs in Microsoft, sent me the following post on the basics of WPF Touch. Its a nice read.. So get started.... WPF Touch Basics Things to know before we start Understanding how RoutedEvents work might provide additional insight for this tutorial. http://msdn.microsoft.com/magazine/cc785480. What is Touch? Essentially it is your finger as the mouse. You can think of Touch as any action involving a single finger. Inertia effects, dragging and throwing something, are not included as part of Touch. Those are covered in Manipulations. Touch events include...
  • Lester's WPF\Silverlight Blog

    3.5 Features: Enabled hyperlinks in RichTextBox

    • 3 Comments
    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...
  • Lester's WPF\Silverlight Blog

    Vista gadgets using WPF

    • 6 Comments
    Vista gadgets using WPF...
  • Lester's WPF\Silverlight Blog

    WPF: Adding speller to custom context menu

    • 2 Comments
    One of the interesting features in Editing is the speller and it works really well. :) One of the ineteresting scenarios when it comes to speller is to add the speller choices to a custom context menu. The speller choices would have to be added in the ContextMenuOpening event handler as below: spellingError = textBox.GetSpellingError(caretIndex); if (spellingError != null ) { foreach ( string str in spellingError.Suggestions) { MenuItem mi = new MenuItem(); mi.Header = str; mi.FontWeight = FontWeights.Bold; mi.Command = EditingCommands.CorrectSpellingError; mi.CommandParameter = str; mi.CommandTarget = textBox; textBox.ContextMenu.Items.Insert(cmdIndex, mi); cmdIndex++; } Separator separatorMenuItem1 = new Separator(); textBox.ContextMenu.Items...
  • Lester's WPF\Silverlight Blog

    sample 3D Xaml code

    • 2 Comments
    I was tweaking some sample xaml code (by AdamSmith) and the result was pretty kewl. So I thought it would be interesting to share it with the readers. The xaml code is attached. A nice extension would be to have a movie list at the bottom such that the selected movie plays... to play the movies you would need Media player 10 installed... I had media player 9 and it took me some searching time to figure that out :) .. EnJoi
  • Lester's WPF\Silverlight Blog

    Sample form using listview

    • 2 Comments
    Recently I was clearing up my documents and I came across this sample I made. Thought it might be useful to someone out there and here it is. It’s basically something like a form but which dynamically grows as and when you fill up the rows. So the typical ‘Add New Row’ button is missing. J … Red (more like pink) rows indicate values being empty; green being obvious. :) .. Typically, you would be using a combobox instead of the textbox. It would result in a better perf experience. The code is simple using a listview which is bound to the data. This might look very familiar to Product Studio if you have used it ;) Code is attached Share this post
  • Lester's WPF\Silverlight Blog

    Cool WPF app - Picture board

    • 2 Comments
    Cool WPF app - Picture board...
  • Lester's WPF\Silverlight Blog

    Mapping mouseclick on 3DModel to a 2D texture coordinate

    • 1 Comments
    Some time back I posted a gadget with the rotating earth. This looked nice but it lacked some interaction. One of the things to make it interactive was to map the point of clicking to the texture applied on the globe. To get the 2D coordinate we need to perform a hittest on the Viewport3D and this will give us access to RayMeshGeometry3DHitTestResult object. This provides info on the mesh, geometrymodel, vertex indices of the triangle hit, and the barycentric coordinates . To obtain the coordinate we multiply the vertex weights (barycentric coordinates) with the cordinates of the triangle hit. We then scale this point with the texture size to get the actual pixel within the texture ( The link to the barycentric coordinates is a nice read and...
  • Lester's WPF\Silverlight Blog

    New WPF Features: Easing Functions

    • 1 Comments
    This is part of a series on New WPF Features Easing functions enables adding custom math formulas to your animations. The animations also looks more realistic and smoother. WPF now provides this functionality and as in SL there are 11 such inbuilt functions. Each of these come with 2 Easing Modes - EaseIn,EaseOut,EaseInOut. The functions for the EaseIn Mode are shown below. < BackEase Amplitude ='1' EasingMode ='EaseIn' /> < BounceEase Bounces ='3' Bounciness ='2' EasingMode ='EaseIn'/> < CircleEase EasingMode ='EaseIn' /> < CubicEase EasingMode ='EaseIn' /> < ElasticEase EasingMode ='EaseIn' Oscillations ='3' Springiness ='3' /> < ExponentialEase EasingMode ='EaseIn' /> < PowerEase...
  • Lester's WPF\Silverlight Blog

    12 handy things/tips to know about Vista

    • 7 Comments
    By now I hope that most of you have atleast tried Vista. If not, join the bandwagon . INSTALL VISTA!!! :) I love every bit of Vista and would like to share some handy tips and also bring into focus some apps that I use a lot. 1> Launch group favorites in IE : This feature is really nice. You can open all items in your Favorites group by clicking on the arrow 2> Shortcuts to quick launch items : We can use Windows key and number keys to launch the quick launch items. So win+1 would result in minimizing all apps 3> Snipping tool : This is a nice tool to get an image clip and to edit it. 4> Windows movie maker : I use this a lot to make movies of photos. You can add your own transitions and audio effects. This...
  • Lester's WPF\Silverlight Blog

    WPF Balloon comments :)

    • 1 Comments
    Pavan has a nice post on creating baloon comments. The first thing that comes to mind on seeing the balloon comments is Comics. And guess what! thats exactly what I tried.. and presto You can get the original source code here . It overlooks positioning the arrows coming out of the comment boxes - this is a minor detail and I added a dependency property for this purpose. The update code is attached . As for the usage: < custom:BalloonDecorator Background = "Pink " PointerLength = " 30 " CornerRadius = " 5 " CornerPosition = " Right" .... /> Share this post
  • Lester's WPF\Silverlight Blog

    WPF Blog Writer

    • 3 Comments
    Recently, I was trying my hand at creating a simple blog writer. The writer came out pretty nice. The app makes use of a base richEditor control (thanks to Praj ).. After a bit of tweaking it ended up like the above... So the app just makes a simple call in the xaml <custom:RichEditor/> ...tada ... you have it there!!! The next thing is to write to a blog... In this case, the writer is coded to post the entry on blogger, which makes use of the Google data API .. this could easily be changed for other blogs. It also makes use of a Xaml-HTML converter as the string passed needs to be in HTML. For now, its a blog writer - hence, it onluy writes. But it could easily be extended into a full blown Blog client. Do I hear anyone taking...
Page 3 of 13 (241 items) 12345»