الجمعة، 6 مايو 2011

WPFs Controls Samples





Combox in WPF





Code
<Window x:Class="WpfApplication11.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
  
    <Grid>
        <ComboBox Margin="79,70,126,171">
           
           

            <StackPanel Orientation="Horizontal" Margin="5" >
                <Image Source="Islamic (9).jpg" Width="150" Height="150"/>
                <StackPanel Width="200">
                    <TextBlock Margin="5,0" FontSize="14" FontWeight="Bold" VerticalAlignment="center"> دعاءTextBlock>
                    <TextBlock Margin="5" VerticalAlignment="center" TextWrapping="Wrap">
                      اللهم اسالك علما"نافعا" ورزقا" طيبا" وعملا"متقبلا
                       اللهم فقهني في الدين وعلمني التأوي
                    TextBlock>
                StackPanel>
            StackPanel>
          
           
           
            <StackPanel Orientation="Horizontal" Margin="5">
                <Image Source="Islamic (8).jpg" Width="150" Height="150"/>
                <StackPanel Width="200">
                    <TextBlock Margin="5,0" FontSize="14" FontWeight="Bold"
VerticalAlignment="center">ياربTextBlock>
                    <TextBlock Margin="5" VerticalAlignment="center" TextWrapping="Wrap">

وهتفتت باسمك ياله لحنا يرن بمسمعي
يارب إني قد غسلت خطيئتي بالأدمع
يارب ها تسبيحتي في مسجدي أو مهجعي
يارب إني ضارع أفلا قبلت تضرعي
إن لم تكن لي في أساي
فمن يكون إذا معي؟؟؟؟

                    TextBlock>
                StackPanel>
            StackPanel>

        ComboBox>
    Grid>
Window>





And to get this look in display data

For each item, the obvious text to use in the selection box is the content of the first TextBlock because it contains the title (such as “Curtain Call” or “Fireworks”).
Because the TextBlock is nested within two StackPanels, the desired property path involves referencing the inner StackPanel (the second child of each item) before referencing the TextBlock (the first child of each inner StackPanel). Therefore, the TextPath attached property can be applied :-
And here's the final update


And to set default value in combox when you run at first time


Tab Control


   <TabControl>
            <TabItem Header="Islam">Content for Tab 1.TabItem>
            <TabItem Header="Mohamed">Content for Tab 2.TabItem>
            <TabItem Header="Egypt">Content for Tab 3.TabItem>
        TabControl>



  
Menu



        <Menu>
            <MenuItem Header="_File">
                <MenuItem Header="_New..."/>
                <MenuItem Header="_Open..."/>
                <Separator/>
                <MenuItem Header="Sen_d To">
                    <MenuItem Header="Mail Recipient"/>
                    <MenuItem Header="My Documents"/>
                MenuItem>
            MenuItem>
            <MenuItem Header="_Edit">
               
            MenuItem>
            <MenuItem Header="_View">
               
            MenuItem>
        Menu>

TreeView


  <TreeView>
            <TreeViewItem Header="Power">
                <TreeViewItem Header="Try">
                   
                TreeViewItem>

                <TreeViewItem Header="Allah">
                    <TreeViewItem Header="Quran"/>
                    <TreeViewItem Header="Islam"/>
                    <TreeViewItem Header="Better Life"/>
                TreeViewItem>
              
                <TreeViewItem Header="Smile">
                   
                TreeViewItem>
             
                <TreeViewItem Header="Mohamed ">
                   
                TreeViewItem>
            TreeViewItem>
        TreeView>


ToolBar
The ToolBar control is typically used to group together many small buttons (or other controls) as an enhancement to a traditional menu system.


   <ToolBar Height="54" Name="toolBar1" Width="309" >

        <Button>
            <Image Source="copy.gif"/>
        Button>
        <Separator/>
        <ToggleButton>
            <Image Source="bold.gif"/>
        ToggleButton>
        <ToggleButton>
            <Image Source="italic.gif"/>
        ToggleButton>
        <ToggleButton>
            <Image Source="underline.gif"/>
        ToggleButton>
        <Separator/>
        <ToggleButton>
            <Image Source="left.gif"/>
        ToggleButton>
        <ToggleButton>
            <Image Source="right.gif"/>
        ToggleButton>
        <ToggleButton>
            <Image Source="justify.gif"/>
        ToggleButton>
        <Separator/>
        <Label>ZoomLabel>
        <ComboBox>
           
        ComboBox>
        <Separator/>
        <Button>
            <Image Source="superscript.gif"/>
        Button>
        <Button>
            <Image Source="subscript.gif"/>
        Button>
    ToolBar>

StatusBar

   

<StatusBar Height="42" Width="272">
        <Label>27 ItemsLabel>
        <Separator/>
        <Label>ZoomLabel>
        <ComboBox SelectionChanged="ComboBox_SelectionChanged">
           
        ComboBox>
        <Separator/>
        <Button>
            <Image Source="justify.gif"/>
        Button>
    StatusBar>

InkCanvas
The amazing InkCanvas is a versatile element whose primary purpose is to capture hand writing (via a mouse or stylus), as pictured. InkCanvas is technically not a control, as it derives directly from FrameworkElement, but it acts very much like a control.


     <InkCanvas Background="Red">
           
        InkCanvas>

Or you can draw in Image
      <InkCanvas Background="Red">
            <Image Source="ahmed.png"/>
        InkCanvas>

Asp.net AdvRotator

Asp.net AdvRotator 


الخميس، 5 مايو 2011

Explain to the XAML in details




Most CLR objects can be expressed as XAML elements (with the exception of abstract base classes and some other nonabstract base classes used strictly for inheritance purposes in the CLR).
 XAML elements are mapped to classes; attributes are mapped to properties or events. At runtime when a XAML element is processed, the default constructor for its underlying class is called, and the object is instantiated; its properties and events are set based on the attribute values specified in XAML.

Resources are a keyed collection of reusable objects. Resources can be created and retrieved using both XAML and C#. Resources can be anything — data templates, arrays of strings, or brushes used to color the background of text boxes. Resources are also scoped, meaning they can be available to the entire Application (global), to the Window, to the User Control, or even to only a specific control.

الأحد، 1 مايو 2011

Introduction to WPF

Windows Presentation Foundation (WPF) is a next generation graphics platform which is included in the Microsoft .NET Framework 3.0 and 3.5. It allows you to build advanced user interfaces (UI) that incorporate documents, media, 2D and 3D graphics, animations, and web-like characteristics. Built on the .NET framework 3.0 and 3.5, WPF provides a managed environment for developing applications using the Windows operating system. Like other features of the .NET Framework 3.0 and 3.5, WPF is available for Windows Vista, Windows XP, and Windows Server 2003.

Software Requirements
To run WPF on your machine you need to have at least the following software installed:
  • Windows XP with Service Pack 2 or higher
  • .NET Framework 3.0 or higher
Hardware requirements
There are no minimum hardware requirements for WPF 


Features

There are several new features in WPF that you can take advantage of when you develop your WPF applications. First, to utilize powerful new graphics hardware, WPF implements a vector graphics model 
based on the Direct3D technology.

This allows graphics to scale according to screen-specific resolution without losing image quality, which is impossible to do with fixed-size raster graphics. WPF leverages Direct3D for vector-based rendering.