Recommended

Skip Navigation LinksHome / Search

Search

 
Results Per Page

Found 4 results for Nikolay Raychev.
Date between: <not defined> and <not defined>
Search in: Tips

Order by Publish Date   Ascending Title   Rating  

  • 5 comments  /  posted by  Nikolay Raychev  on  Apr 02, 2009 (more than a year ago)
    Silverlight 3 comes with two built in Pixel Shaders:

    We have the following image:



    We want to blur it:

    <Image Width="300"   
        Source="http://terraristic.net/photos/  
        Brachypelma_albiceps/Brachypelma_albiceps_1.jpg"> 
        <Image.Effect>
            <BlurEffect Radius="8"></BlurEffect>
        </Image.Effect>
    </Image> 

    We have the following result:



    Note the Radius parameter. The bigger the radius is, the more blurred the picture is.

    Now let's make a shadowed picture:

    <Image Width="300"   
        Source="http://terraristic.net/photos/  
        Brachypelma_albiceps/Brachypelma_albiceps_1.jpg"> 
        <Image.Effect>
            <DropShadowEffect BlurRadius="30" Color="Gray"
                Direction="-45" Opacity="0.5" ShadowDepth="20">
            </DropShadowEffect>
        </Image.Effect> 
    </Image> 

    The result:

     

    The DropShadow effect has several parameters:
    • BlurRadius - the bigger the radius is, the more blurred the shadow is.
    • Color - the shadow color.
    • Direction - an angle specifying the direction of the shadow. If you set it to zero the shadow will fall on the right side.
    • Opacity - the shadow opacity.
    • ShadowDepth - it specifies how far (deep) from the picture the shadow will appear.

    You can define your own Pixel Shaders using a special language called HLSL. But this is beyond the scope of this tip.



  • 1 comments  /  posted by  Nikolay Raychev  on  Apr 02, 2009 (more than a year ago)
    In Silverlight 3 you can make multiple selections in a ListBox. You just need to set the SelectionMode parameter:

    <ListBox Margin="5" x:Name="lbTasks"   
        ItemsSource="{Binding Tasks, ElementName=MainPageView}"   
        SelectionMode="Multiple">  
        <ListBox.ItemTemplate> 
            <DataTemplate> 
                <StackPanel Orientation="Horizontal" Margin="2">  
                    <TextBlock FontWeight="Bold" FontSize="13"   
                        Foreground="#ff006882" Text="{Binding Text}">  
                    </TextBlock> 
                </StackPanel> 
            </DataTemplate> 
        </ListBox.ItemTemplate> 
    </ListBox> 

    You have 3 options for the SelectionMode:
    • Single - you can select only one item.
    • Multiple - you can select multiple items by selecting one item, holding Ctrl or Shift key and pressing another item.
    • Extended - you can again select multiple items but the Shift key acts differently. With the help of the Shift key you can select items range by just pressing one item, holding Shift and pressing another one.
  • 1 comments  /  posted by  Nikolay Raychev  on  Mar 25, 2009 (more than a year ago)
    It's very easy to style the caret in Silverlight 3. Look at that huge TextBox with a caret in the rainbow colors:



    You just need to set the CaretBrush property:

    <TextBox FontSize="50" Width="100" Height="80">  
        <TextBox.RenderTransform> 
            <ScaleTransform ScaleX="6" ScaleY="1"/>  
        </TextBox.RenderTransform> 
        <TextBox.CaretBrush>
            <LinearGradientBrush x:Name="backgroundLinearGradientBrush"
                MappingMode="RelativeToBoundingBox"
                    StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Color="Red" Offset="0" />
                    <GradientStop Color="Orange" Offset="0.167" />
                    <GradientStop Color="Yellow" Offset="0.333" />
                    <GradientStop Color="Green" Offset="0.5"/>
                    <GradientStop Color="Blue" Offset="0.667" />
                    <GradientStop Color="Indigo" Offset="0.833" />
                    <GradientStop Color="Violet" Offset="1" />
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
        </TextBox.CaretBrush> 
    </TextBox> 

    You can use any Silverlight supported Brush.

  • 6 comments  /  posted by  Nikolay Raychev  on  Mar 19, 2009 (more than a year ago)

    In Silverlight 3 you are able to check if an internet connection is present. You can also detect network changes.

    See also:
    Silverlight 3 as a Desktop Application (Out-of-Browser Applications)

    Network availability checking:

    if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())  
    {  
        this.InitTasks();  

    Network change detection:

    NetworkChange.NetworkAddressChanged += new 
    NetworkAddressChangedEventHandler(NetworkChangedCallback); 

     

    private void NetworkChangedCallback(object sender, EventArgs e)  
    {  
        if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())  
        {  
            this.InitTasks();  
        }  

    Demo

    As an example I created the following demo:


    This is a simple tasks list. You can add or delete tasks. The tasks are saved on the server and the application is using WCF Service to connect to the server. Nothing special. But if you save the application for offline use you can use it even if you don't have internet connection. I'm using the isolated storage to keep copy of the data on the client and the application is working with the local copy when there is no connection. It synchronizes automatically whenever the connection comes back.

    Download Source 

     


Help us make SilverlightShow even better and win a free t-shirt. Whether you'd like to suggest a change in the structure, content organization, section layout or any other aspect of SilverlightShow appearance - we'd love to hear from you! Need a material (article, tutorial, or other) on a specific topic? Let us know and SilverlightShow content authors will work to have that prepared for you. (hide this)