Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

GridViewColumn url wpf

        private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
    {
        Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
        e.Handled = true;
    }

    //

    private void CreateDynamicGridView()
    {
        // Create a GridView  
        GridView grdView = new GridView();
        grdView.AllowsColumnReorder = true;
        grdView.ColumnHeaderToolTip = "Authors";

        GridViewColumn nameColumn = new GridViewColumn();
        nameColumn.DisplayMemberBinding = new Binding("Name");
        nameColumn.Header = "Author Name";
        nameColumn.Width = 120;
        grdView.Columns.Add(nameColumn);

        GridViewColumn ageColumn = new GridViewColumn();
        ageColumn.DisplayMemberBinding = new Binding("Age");
        ageColumn.Header = "Age";
        ageColumn.Width = 30;
        grdView.Columns.Add(ageColumn);

        GridViewColumn bookColumn = new GridViewColumn();
        bookColumn.DisplayMemberBinding = new Binding("Book");
        bookColumn.Header = "Book";
        bookColumn.Width = 250;
        grdView.Columns.Add(bookColumn);

        GridViewColumn mvpColumn = new GridViewColumn();
        mvpColumn.DisplayMemberBinding = new Binding("Mvp");
        mvpColumn.Header = "Mvp";
        mvpColumn.Width = 50;
        grdView.Columns.Add(mvpColumn);

        ListView1.View = grdView;
    }


    private ArrayList AuthorsList()
    {
        ArrayList list = new ArrayList();
        list.Add(new Author("http://google.com", "Mahesh Chand", 30, "ADO.NET Programming", true));
        list.Add(new Author("http://facebook.com", "Mike Gold", 35, "Programming C#", true));
        list.Add(new Author("http://google.com", "Raj Kumar", 25, "WPF Cookbook", false));
        list.Add(new Author("http://ok.ru", "Tony Parker", 48, "VB.NET Coding", false));
        list.Add(new Author("http://mail.ru", "Renee Ward", 22, "Coding Standards", true));
        list.Add(new Author("http://ya.ru", "Praveen Kumar", 33, "Vista Development", false));

        return list;
    }

    private void MenuItem_Click(object sender, RoutedEventArgs e)
    {

    }
}


public class Author
{
    public Author(string url, string authorName, Int16 authorAge, string authorBook, bool authorMVP)
    {
        this.Url = url;
        this.Name = authorName;
        this.Age = authorAge;
        this.Book = authorBook;
        this.Mvp = authorMVP;
    }

    private string _url;
    public string Url
    {
        get { return _url; }
        set { _url = value; }
    }

    private string name;

    public string Name
    {
        get { return name; }
        set { name = value; }
    }
    private Int16 age;

    public Int16 Age
    {
        get { return age; }
        set { age = value; }
    }
    private string book;

    public string Book
    {
        get { return book; }
        set { book = value; }
    }
    private bool mvp;

    public bool Mvp
    {
        get { return mvp; }
        set { mvp = value; }
    }

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #GridViewColumn #url #wpf
ADD COMMENT
Topic
Name
5+8 =