Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DataGridTextBoxColumn.WidthChange to trigger method

DataGridTextBoxColumn.WidthChange to trigger method

Scheduled Pinned Locked Moved C#
helpquestiondatabasewindows-admintutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikemilano
    wrote on last edited by
    #1

    I would like to write the width of a cell in a datagrid to the registry when a user changes the size. I'm using a TableStyle to customize this DataGrid. ( just from the code, not the gui ) I have a method named: SaveSettings() which writes the current width of the datagrid cells to the registry. The problem is that I can not figure out how to trigger this method. Here is how I setup my dg column .. can someone help me with a way to trigger a method on change of the width of this column? DataGridTextBoxColumn DetailID = new DataGridTextBoxColumn(); DetailID.HeaderText = "Detail ID"; DetailID.MappingName = "DetailID"; DetailID.Width = 50; DetailID.WidthChanged // how do i use this ? Thanks in advance.

    R 1 Reply Last reply
    0
    • M mikemilano

      I would like to write the width of a cell in a datagrid to the registry when a user changes the size. I'm using a TableStyle to customize this DataGrid. ( just from the code, not the gui ) I have a method named: SaveSettings() which writes the current width of the datagrid cells to the registry. The problem is that I can not figure out how to trigger this method. Here is how I setup my dg column .. can someone help me with a way to trigger a method on change of the width of this column? DataGridTextBoxColumn DetailID = new DataGridTextBoxColumn(); DetailID.HeaderText = "Detail ID"; DetailID.MappingName = "DetailID"; DetailID.Width = 50; DetailID.WidthChanged // how do i use this ? Thanks in advance.

      R Offline
      R Offline
      Roger Stewart
      wrote on last edited by
      #2

      DetailID.WidthChanged += new EventHandler(MyIDColumnWidthChanged); Then write the method body for MyIDColumnWidthChanged. See Consuming Events[^] for further help on hooking up the event. Roger Stewart "I Owe, I Owe, it's off to work I go..."

      M 1 Reply Last reply
      0
      • R Roger Stewart

        DetailID.WidthChanged += new EventHandler(MyIDColumnWidthChanged); Then write the method body for MyIDColumnWidthChanged. See Consuming Events[^] for further help on hooking up the event. Roger Stewart "I Owe, I Owe, it's off to work I go..."

        M Offline
        M Offline
        mikemilano
        wrote on last edited by
        #3

        Thank You very much. It works great! Would not have been able to do it without the consuming events link also =)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups