الجمعة، 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>

0 التعليقات: