h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

WPF Day-1

Introduction to WPF:
WPF: Windows Presentation Language.
·  It is a Next level of presentation system for building windows Client Application.
·  You can create Standalone and browser-hosting Application.
·  It is a resolution -Independent and Vector based rendering engine.
·  Application Development features that include Extensible Application Markup Language (XAML).Controls, data binding, layout, 2-D, 3-D, animation and So On.
·  WPF includes additional Programming constructs that enhance properties and events.
·  WPF Properties are Dependency Properties.
·  WPF events are Routed Events.
·  WPF contains many elements.
Application Model:
WPF Provides types and services that are collectively known as “Application Model”.
Standalone Application:
·  You can use windows class in the Application that is called “Standalone Application”.
·  You can create and use Windows, Dialog Box, MesageBox, menubar in the Standalone Application.
Browser Host Application:
§  Browser Host Application knows as “XAML browser application (XBAP).
§  You can create and use Page(s), Page functions in Browser Host Application.
§  It can be hosted in the IE 6 and IE 7.
Application Class:
§  Require additional application-scoped services, including startup and lifetime management.
§  It supports XBAP and Standalone Application.
XAML Overview:
     XAML is XML based markup language.
     It typically used to create windows, User Controls, pages and Dialog boxes and So On. I give an example for create a Button in XAML.
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    Title="Window with Button"
    Width="250" Height="100">
  <Button Name="btn_Hi">Hi! </Button>
</Window>
Here, the XAML defines Windows and a button by using Windows and Button elements. Each element has attributes.
WPF Controls:
          Here, I will give some list of controls in WPF.
  • ·  AccessText
  • ·  Border Control
  • ·  Button Control
  • ·  BulletDecorator Control
  • ·  Canvas Control
  • ·  Calendar Control
  • ·  CheckBox Control
  • ·  ComboBox Control
  • ·  ContextMenu Control
  • ·  Datagrid Control
  • ·  DatePicker Control
  • ·  DockPanel Control
  • ·  DocumentViewer Control
  • ·  Expander Control
  • ·  FlowDocumentPageviewer Control
  • ·  FlowDocumentReader Control
  • ·  FlowDocumentScrollviewer Control
  • ·  Frame
  • ·  Grid Control
  • ·  GridView Control
  • ·  GridSplitter Control
  • ·  GroupBox Control
  • ·  Hyperlink
  • ·  Image Control
  • ·  InkCanvas Control
  • ·  InkPresenter Control
  • ·  Label
  • ·  ListView Control
  • ·  ListBox Control
  • ·  Menu
  • ·  MediaElement
  • ·  NavigationWindow
  • ·  OpenFiledialog Control
  • ·  PasswordBox Control
  • ·  Panel Control
  • ·  Page
  • ·  PrintDialog Control
  • ·  Popup
  • ·  ProgressBar
  • ·  RadioButton
  • ·  Repeated Control
  • ·  ResizeGrip Control
  • ·  RichTextBox Control
  • ·  SaveFileDialog Control
  • ·  Separator Control
  • ·  ScrollBar Control
  • ·  ScrollViewer Control
  • ·  Slider
  • ·  SoundPlayerAction
  • ·  StackPanel Control
  • ·  StrickNoteControl
  • ·  StatusBar
  • ·  TabControl
  • ·  TextBlock
  • ·  TextBox Control
  • ·  Thumb Control
  • ·  ToolTip
  • ·  ToolBar
  • ·  TreeviewControl
  • ·  Viewbox Control
  • ·  VirtualizingStackPanel Control
  • ·  Window Control
  • ·  WrapPanel Control      
Now, I am trying to explain the usage of every control in WPF. I explain alphabetical order.
First we will discuss about AccessText.
·  AccessText :
          User can create an Access key using underscore.
Suppose user uses this below in the XAML .user gets error.
<Button Content="Ok" Click="btn_Clicked">
            <AccessText>_Ok</AccessText>
           </Button>
Error: The property 'Content' is set more than once.
Reason:
  Because we can use Content or AccessText in the Control.
Conclusion:
  I hope, you get some ideas about WPF and AccessText.Thanks for reading this article. We will talk about other controls in next Chapters.              

Reverse a Number using C#.Net

Here i will give method for displaying reverse of Integer value using C#.net
ReverseValue is a method for display reverse of integer.
 public static string ReverseValue(int value)
        {
           
            int reverse = 0;
            while (value  > 0)
            {
                int rem = value % 10;
                reverse = (reverse * 10) + rem;
                value = value / 10;

            }
            result =reverse.ToString();
            return result;
        }

Call method :
   string str = DerivedClass.ReverseValue(123456789);
    MessageBox.Show(str.ToString());

Read and Write a Application configuration using C#.net

Here, I give an read and Write an Application Configuration file using C#.net.
First , we know the meaning of Application Configuration file.
Application Configuration file:
             It is simply says that Store configuration Information.you can store a information in the structure like this Key and Value.Each application can have a One configuration file.It is a XML file .you can open any format (like Notepad).
Now we will go to our Topic:
How to create a Application configuration file in our Application?
  Let start ,
      Create a Project .
      "Right click" on the Project name in the Solution Explore.
      Click "Add" and Click "New Item".
       Add New Item window will display.
       Click "Application Configuration file" in the window.
       Give a  Name of the Config file or Default name displays in the window like this  (App1.config).
         Click "ADD" button in the Window.
Now, we see the lines in the Config File

    <!--?xml version="1.0" encoding="utf-8" ?-->
    <configuration>
    </configuration>

Now we add some keys and Values between appSetting tag.Before we add a appSetting between configuration tag.

    <!--?xml version="1.0" encoding="utf-8" ?-->
    <configuration>
  <appsettings>
        <add key="C#" value="EasyToLearn"></add>
      </appsettings>
    </configuration>

Now ,How to add a Key and Value  using C#.net?
ADD a Key and Value:
In my Project , I create a Class for ADD and Read Key and  value in the Configuration file.
Create a Class file .
My Class file Name is AppConfig.cs

    using System.Configuration;
    using System.Windows.Forms;

I create a small function for adding a Key and Value in the Configuration file.

    public static void AddintoConfigsetting(string appkeys,string appvalues)
       {
           Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
           config.AppSettings.Settings.Add(appkeys, appvalues);
           config.Save(ConfigurationSaveMode.Modified);
           ConfigurationManager.RefreshSection("appSetting");
           ShowConfigsetting();
       }

To retrieve the keys and Values from Configuration file

    public static void ShowConfigsetting()
       {
           foreach (string key in ConfigurationManager.AppSettings)
          {
              string value = ConfigurationManager.AppSettings[key];
              string result = "Keys :" + " " + key + " " + "Key value:" + " " + value;
              MessageBox.Show(result);
           }
      }

  Now we go to our form:
       Create a form
       Form contains Two Command buttons.
       One is "Add Key and Value"
       another one is "Read Keys and Values"
 call the class file function in the Form.cs
add the following code click event of  ADD Key and Value button

   AppConfig.AddintoConfigsetting("EmpId","1010");

add the following code click event of  Read Keys and Values button

    AppConfig.ShowConfigsetting();

Conclusion:
    Today we learn the Application Configuration file.Thanks for spend a value time .

Read Assemble information of Project

Here, I write a code for getting Assemble information of Project.
Get Company Name:
    string str = "This Company Name is" + " " + Application.CompanyName;
    MessageBox.Show(str);
Get Current Input Language:
    string CurrentInputlan = "Current Input Language is " + "  " +     Application.CurrentInputLanguage.Culture.EnglishName;
   MessageBox.Show(CurrentInputlan);
Get Product Name:
    string prtName = "Product Name is " + "  " + Application.ProductName;
    MessageBox.Show(prtName);
Get Product Version :
    string prtVersion = "Product Version is " + "  " + Application.ProductVersion;
    MessageBox.Show(prtVersion);