25 August 2012

WPF Day-3

Introduction:
    Last Two days, we talked about WPF Introduction, AccessText Control and Board. Today we will discuss about Button and BulletDecorator Control
·  Button Control:
                     Button is an intermediary between forms or controls.
  Create Button in XAML:
     <Button Name="btn_can" Margin="88,118,102,120">Cancel</Button>
<Button  Height="33" Margin="88,0,99,59" Name="btn_Ok" VerticalAlignment="Bottom" Click="btn_OK_Click">OK</Button>
Create Border in Coding:
   private void btnControl()
        {
            btn_Exit = newButton();
            btn_Exit.Background = Brushes.Ivory ;
            btn_Exit.Content = "Exit";
            btn_Exit.Name = "ButtonExit";
            btn_Exit.Height = 30;
            btn_Exit.Width = 50;
            btn_Exit.Margin = newThickness(10, 10, 20, 50);
            btn_Exit.Click += new RoutedEventHandler(btn_Exit_Click);
            this.Content = btn_Exit;
    }
  private void btn_Exit_Click(objectsender, RoutedEventArgs  e)
        {
            stringbtnName = btn_Exit.Name;
            MessageBox.Show(btnName);
    }
   private void Window_Loaded(objectsender, RoutedEventArgs e)
        {
               btnControl();
   }

·  BulletDecorator Control:
      It starts from .Net Framework 4.5.
                Represents a layout control that aligns a bullet and another visual object.
Please refer this: http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.bulletdecorator.aspx
Conclusion:
  I hope, you get some ideas about Button and BulletDecorator Control in WPF. Thanks for reading this article. We will talk about other controls in next Chapters.              

No comments: