(X) Hide this Upcoming webinar on Feb 23rd, 10 am PST (see your local time): Building Line-of-business Applications with Silverlight & WCF Data Services
More webinar info | Register | Other webinars
Tweet @silverlightshow and win a SilverlightShow Tweet-shirt. Learn how >>
Skip Navigation LinksHome / Search

Search

 
Results Per Page

Found 49 results for Denislav Savkov.
Date between: <not defined> and <not defined>
Search in: News , Articles , Tips , Shows , Showcase , Books

Page 
Order by Publish Date   Ascending Title   Rating  

  • 4 comments  /  posted by  Denislav Savkov  on  Oct 13, 2008 (more than a year ago)

    This article is compatible with the latest version of Silverlight.

    Introduction

    In this article we are going to explore some of the features of the ComboBox. Also we change the look of the control using a few templates based on the default control templates. You can see all the source code here.

    Download source.

    ComboBox and ListBox

    The ComboBox control is very similar to the ListBox control. It derives from ItemsControl and Selector, it has ItemContainer property but it also has a few additional things that are connected with the drop down items menu.



  • 5 comments  /  posted by  Denislav Savkov  on  Sep 30, 2008 (more than a year ago)

    For the purpose of this article the following browsers are used: Internet Explorer 7; Internet Explorer 8 Beta 2 - 8.0.6001.18241; Firefox 2 - 2.0.17; Firefox 3 - 3.0.2; Safari - 3.1.2.

    Introduction

    Recently we started wondering if there is a noticeable difference in the performance of Silverlight in different browsers.  Measuring performance reliably is not a trivial task.  One thing is that performance have many aspects like rendering graphics and manipulating large data. Obviously to rate overall performance you need to balance the weight of individual aspect ratings.  Finding the appropriate balance depends on the purpose of the rating. Since Silverlight's primary task is to create RIA  we decided to test first the graphics rendering performance.

    Benchmark

    There are a few popular benchmarks that compare Flash vs.

  • 0 comments  /  posted by  Denislav Savkov  on  Sep 30, 2008 (more than a year ago)

    Download Silverlight Tools for Visual Studio 2008 SP1 ( including the Silverlight 2 RC0 runtime ).

    And the latest Expression Blend.

    First we should point out this release is intended to be used only from developers to begin migrating their existing code to RTW. The applications build with the tools will run only on the Silverlight 2 RC0 Developer Runtime an not on the Beta 2 runtimeAlso the full version of Silverlight 2.0 will have the same features as RC0 i.e. more functionality won't be added from this release until the final.

    New features

    • New controls
      • PasswordBox, ComboBox, MessageBox and ProgressBar.
    • Improvement in controls
      • Improved accessibility and UI automation
      • Updated look and feel
      • IsEnabled and IsEnabledChanged added
      • Exposed virtual methods for On* events on Control e.g. OnGotFocus, OnKeyDown, OnKeyUp, OnMouseEnter etc.
    • CompositionTarget.Rendering event allows per-frame callbacks for physics and custom animation.
    • Networking
      • Support for HTTP requests on background threads.
  • 3 comments  /  posted by  Denislav Savkov  on  Sep 18, 2008 (more than a year ago)

    Silverlight doesn't support mouse wheel event. There is a way to catch them if we ask to the browser for them. This workaround works well if the page with your Silverlight application fits in the browser. If the page is bigger in height a scroll appears. Then the whole content of the page is scrolled and the SL application doesn't receive the wheel event until one end is reached.

    Hook up to the event. Different names are used in the different browsers.

    C#

    using System.Windows.Browser;
    ...
    HtmlPage.Window.AttachEvent( "DOMMouseScroll", OnMouseWheel ); // Mozilla
    HtmlPage.Window.AttachEvent( "onmousewheel", OnMouseWheel );
    HtmlPage.Document.AttachEvent( "onmousewheel", OnMouseWheel ); // IE

    This is how you get the wheel delta.

    C#

    private void OnMouseWheel( object sender, HtmlEventArgs args )
     {
         double mouseDelta = 0;
         ScriptObject e = args.EventObject;
         // Mozilla and Safari
         if ( e.GetProperty( "detail" ) != null )
         {
             mouseDelta = ( ( double )e.GetProperty( "detail" ) );
         }
         // IE and Opera
         else if ( e.GetProperty( "wheelDelta" ) != null )
             mouseDelta = ( ( double )e.GetProperty( "wheelDelta" ) );
     
         mouseDelta = Math.Sign( mouseDelta );
    }

    That's it!

  • 1 comments  /  posted by  Denislav Savkov  on  Sep 18, 2008 (more than a year ago)

    These are the differences:

    • Is it possible to apply a style to all elements in your application?

    Unforunately, the Beta 2 does not support implicit styles using the TargetType attribute like WPF. To apply a style to all elements you must explicitly set a value to each Style property.

    • Is it possible to extend a style?

    In Silverlight styles cannot be based on other styles. In WPF that is possible using the BasedOn attribute

    • Is it possible to change the style of a control more than once?

    No. Styles can be set only once in Silverlight in XAML or in code. After applying a style it is possible to change individual control properties though. You can affect the appearance of a control by changing the Template property and you can do that as many times as you want.

    That's it!

  • 0 comments  /  posted by  Denislav Savkov  on  Sep 18, 2008 (more than a year ago)

    Changing the default style or template of a control from the standard library is the same as with any other control. Except to create your own style it is good to know the parts and the states that compose the standard style. Microsoft has released the full XAML of a number of controls along with description of their visual states and state groups - Control Styles and Templates. Additionally using the reflector you can extract the styles of some slightly different controls, we did that and uploaded the generic.xaml file for you. Lastly, in the Reflector you can see the states and parts of every control  listed on the first line of the page. See how to disassemble Silverlight assemblies here.

     

    ListBox has only one visual part - ScrollViewer.

     

    Here you see two of the six Button visual states.

     That's it!

  • 0 comments  /  posted by  Denislav Savkov  on  Sep 18, 2008 (more than a year ago)

    Just use the following line.

    C#

    Application.Current.Host.Content.IsFullScreen = true;   

    Entering full-screen mode in Silverlight has some restrictions. To ensure that it is initiated by the user entering full-screen mode is possible only in response to one of these input events: MouseLeftButtonDown. MouseLeftButtonUp, KeyDown, KeyUp.

    That's it!

  • 0 comments  /  posted by  Denislav Savkov  on  Sep 16, 2008 (more than a year ago)

    Typically validation occurs when in a two-way binding the business object (source property) is updated with data from the user input (target property). During the update there are two places where validation occurs.

    1. First, the binding engine uses a implementation of IValueConverter to convert the data from one type to the other. Usually this converter has some validation. Unfortunately, Silverlight doesn't provide a way for custom validation for binding, like in WPF. There is no ValidationRule class that is used in WPF to provide the custom rule for the validation.
    2. Second, the setter of the property being updated may contain validation.

    This means that if you want custom validation you have to write your own type converters or to place the validation inside the setters of your business object. In case the validation fails, an exception is thrown in a setter or in a converter , then a BindingValidationError event is raised (it is member of System.Windows.Controls.FrameworkElement). This makes it easy for you to prompt the user to enter correct data. BindingValidationError can be raised only when both NotifyOnValidationError and ValidatesOnExceptions are true. Setting ValidatesOnExceptions to true tells the binding engine to report validation exceptions and setting NotifyOnValidationError to true tells the binding engine to raise the BindingValidationError event when a validation error occurs. This, combined with the TwoWay mode of binding, gives us the following:

    XAML

    <TextBox x:Name="bindingTarget" Text="{Binding Path=Age,
                                                   Source={StaticResource person},
                                                   Mode=TwoWay,
                                                   NotifyOnValidationError=true,
                                                   ValidatesOnExceptions=true}" />. 
    C#
    bindingTarget.BindingValidationError +=
                 new EventHandler<ValidationErrorEventArgs>( bindingTarget_BindingValidationError );

    Here Age is a property of the object person.

    Strangely BindingValidationError won’t raise if you use custom type converters in your binding. Check out our demo and download the source.

    That's it!

  • 0 comments  /  posted by  Denislav Savkov  on  Sep 16, 2008 (more than a year ago)

    The callback function of a routed event has the second parameter e of type RoutedEventArgs or its inheritor. The Source property of this parameter holds reference to the object that raised the event. In contrast to that the sender parameter holds reference to the object where the event handler was invoked.

    C#

    void RoutedEventRaised( object sender, RoutedEventArgs e )
    {
        object source = e.Source;
    }

    That's it!

  • 6 comments  /  posted by  Denislav Savkov  on  Sep 16, 2008 (more than a year ago)

    Some of the new features in C# 3.0 allow you to write shorter code that is easier to read and maintain. The following code couples have the same results.

    • Short syntax for object initialization initialization.

      C#

       

      ObjectType objectName = new ObjectType();
      objectName.PropertyName = newValue;
      objectName.PropertyName2 = newValue2;
       

       

      C#

      ObjectType objectName = new ObjectType(){ PropertyName = newValue, PropertyName2 = newValue2 };
    • Syntaxt for anonymous types

    C#

    SomeVeryLongNameOfType objectName = new SomeVeryLongNameOfType();

    C#

    var objectName = SomeVeryLongNameOfType();
    • Short syntax for collection initialization

    C#

    CollectionType collectionName = new CollectionType();
    collectionName.Add( newItem1 );
    ..
    collectionName.Add( newItemN );

    C#

    CollectionType collectionName = new CollectionType() { Item1,...,ItemN };

     

    That's it!


Page