locked
Slider in DataGrid RRS feed

  • Question

  • Could you please confirm me if Slider control is supported within a DataGrid?
    Sandro Peixoto
    Tuesday, July 26, 2011 8:29 PM

Answers

  • Yes.  With DataGrid Template Column you can use whatever control you like.
    • Proposed as answer by Sheldon _Xiao Thursday, July 28, 2011 6:52 AM
    • Marked as answer by Sandro Peixoto Saturday, July 30, 2011 8:29 AM
    Tuesday, July 26, 2011 11:30 PM
  • Suppose you have a class like this.

      public class Task
      {
        public string Description
        { get; set; }
    
        public double PercentComplete
        { get; set; }
      }
    
    

    Then you can define DataGridTemplateColumn and define data template in it. It would be something like this.

            <DataGridTemplateColumn Header="Perecent Complete">
              <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                  <Slider Margin="5" Minimum="0" Maximum="100" Value="{Binding Path=PercentComplete, UpdateSourceTrigger=PropertyChanged}"/>
                </DataTemplate>
              </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>
    
    


    You can see the complete example with screen shot here.

    http://zamjad.wordpress.com/2011/07/27/using-slider-in-datagrid/

     

    Regards

    Zeeshan Amjad

    http://zamjad.wordpress.com/

     

     

     

     


    http://zamjad.wordpress.com
    • Proposed as answer by Sheldon _Xiao Thursday, July 28, 2011 6:52 AM
    • Marked as answer by Sandro Peixoto Saturday, July 30, 2011 8:29 AM
    Wednesday, July 27, 2011 5:38 PM
  • Hi Sandro Peixoto,

    How about your concern?


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, July 28, 2011 6:52 AM

All replies

  • Yes.  With DataGrid Template Column you can use whatever control you like.
    • Proposed as answer by Sheldon _Xiao Thursday, July 28, 2011 6:52 AM
    • Marked as answer by Sandro Peixoto Saturday, July 30, 2011 8:29 AM
    Tuesday, July 26, 2011 11:30 PM
  • Suppose you have a class like this.

      public class Task
      {
        public string Description
        { get; set; }
    
        public double PercentComplete
        { get; set; }
      }
    
    

    Then you can define DataGridTemplateColumn and define data template in it. It would be something like this.

            <DataGridTemplateColumn Header="Perecent Complete">
              <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                  <Slider Margin="5" Minimum="0" Maximum="100" Value="{Binding Path=PercentComplete, UpdateSourceTrigger=PropertyChanged}"/>
                </DataTemplate>
              </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>
    
    


    You can see the complete example with screen shot here.

    http://zamjad.wordpress.com/2011/07/27/using-slider-in-datagrid/

     

    Regards

    Zeeshan Amjad

    http://zamjad.wordpress.com/

     

     

     

     


    http://zamjad.wordpress.com
    • Proposed as answer by Sheldon _Xiao Thursday, July 28, 2011 6:52 AM
    • Marked as answer by Sandro Peixoto Saturday, July 30, 2011 8:29 AM
    Wednesday, July 27, 2011 5:38 PM
  • Hi Sandro Peixoto,

    How about your concern?


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, July 28, 2011 6:52 AM