Set parent control's property with change in child control's property value in XAML (Using AncestorType binding)

In XAML, one can set parent's property from the change in a property of child control. To do so we can use AncestorType binding for the child control.

Consider an example we have a StackPanel having a TextBox. Which ever color user enters in the textbox must be reflected in the StackPanel's Background.

XAML

<StackPanel Orientation="Vertical" x:Name="stk">             <StackPanel Orientation="Horizontal">                 <TextBlock Text="Enter Color:"></TextBlock>   <TextBox x:Name="colorName" Width="150" BorderBrush="Brown"      Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,         AncestorType={x:Type StackPanel}}, Path=Background,Mode=OneWayToSource}">   </TextBox><TextBox Text="Color Format = ARGB"></TextBox>             </StackPanel> </StackPanel>

Output

Secure waiting Timer with JQuery

Many time in our web-site, we used to put a waiting timer for user to wait to take any further action.This timer can be written in JavaScript or in JQuery. The drawback of the writing the timer in JavaScript is that it is not secure. Anyone can override the timer by executing the javascript from browser's address bar. So to overcome this situation we need to synchronize the timer with the server.

Consider the code for the JavaScript Timer written below


<html>
<head>
<script type="text/javascript">
    var waitTime = 90;
    function startJSTimer() {
        try {
          setInterval(function () {
          if(waitTime>0){
             waitTime = waitTime - 1;
             document.getElementById("timer_count_js").innerHTML = waitTime;
           }
           else{
               return false;
             }
           }, 1000);
        }
        catch (ex) {
            alert('Error');
        }
    }
</script>
</head>
<body>
<div id="timer_blockjs" style="border-color: Black;" title="JavaScript Timer">
<div class="content">
        <div>
seconds</div>
<div id="Div2">
            <span id="timer_count_js">90</span>
        </div>
<div class="text">
<a href="#" id="start_timer_js" onclick="startJSTimer();">Start timer</a></div>
</div>
</div>
</body></html>

In the above html code the timer is written in Javascript which can easily be changed by executing the following javascript from Address Bar..

javascript:function A(){waitTime=1;} A();


Google Nexus 4 Features , Tech Specs and Bugs



Google has recently announced its new phone Nexus 4 which is manufactured by LG. It is the first smartphone which will is running on Android 4.2 JellyBean operating system.
This phone is amazing without any doubt in terms of its features. But what amazes more is its low price.
In US, you can get its 8GB version for just 299$ and 16GB version for 349$. Isn’t that amazing?
Google Nexus 4


WPF: Working with Event Triggers

While an ordinary trigger waits for a property change to occur, an event trigger waits for a specific event to be fired. You might assume that at this point you use setters to change the element, but that’s not the case. Instead, an event trigger requires that you supply a series of actions that modify the control. These actions are used to apply an animation.

Here I am taking a very simple example to explain  how can we use event triggers, Suppose I have a button and a textblock on my window. I want the controls to be grown up when mouse enters and reset as mouse leaves


WPF: Rotation and Scale Transform Example



This is a simple example which explains how we can apply render and scale transform.
In this example we have an image and we will apply scale and render transform to this image.
Render transform will help us to rotate the image at specific angle. Similarly, Scale Transform will reduce or increase the size of image in X or Y axis direction.

In the example we have used: 
1)      Image 
2)      3 Scrollbars which are bounded with angle of rotation, scale x and scale y property.

Here is the XAML source code for the same: