This is a migrated thread and some comments may be shown as answers.

Remove Tabstop on grid column when template control is disabled

6 Answers 109 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Srikanth
Top achievements
Rank 1
Srikanth asked on 14 Jan 2013, 03:13 PM

 <gridColumns:BetaTextBoxColumn Header="Price" Width="80" IsVisible="{Binding Source={StaticResource ParentViewModel}, Path=DataSource.PositionsColumnsVisible}" >
    <telerik:GridViewColumn.CellTemplate>
          <DataTemplate >
             <TextBox 
                Text="{Binding [_20047].Value,UpdateSourceTrigger=PropertyChanged,  Mode=TwoWay}" 
                commonUI:ExtendedProperties.RegEx="{Binding Path=[_20047].RegEx}" 
                IsEnabled="{Binding Path=[_20047].IsEnabled}"                                        
                Height="20" MinHeight="20">                      
              </TextBox>
           </DataTemplate>
     </telerik:GridViewColumn.CellTemplate>
  </gridColumns:BetaTextBoxColumn>

In the above XAML i need to remove Tabstop for when the Textbox is disabled. Is there a way I can bind the Gridviewtabstop to "IsEnabled" property of templated textbox ?



6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 14 Jan 2013, 03:59 PM
Hi,

You can set the column to be IsEnabled="False" instead. That will remove the TabStop. Would this be a valid option for you?
 

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Srikanth
Top achievements
Rank 1
answered on 14 Jan 2013, 04:05 PM
I don't see "IsEnabled" property on the column?
0
Dimitrina
Telerik team
answered on 14 Jan 2013, 04:17 PM
Hi,

Indeed you are right. Please excuse me for misleading you, it turns out that there is not such a property for the column.
In that case you can bind the value for the TabStopMode to a new property that you can expose in your ViewModel. Based on whether the TextBox should be enabled or disabled, you will return the appropriate value (Skip, Stop) for that new property.
 

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Srikanth
Top achievements
Rank 1
answered on 14 Jan 2013, 09:23 PM
I can do that but I want the tabstop to be specific the gridviewcell not the whole column. Each row in the grid can change based on the business rules. If i change tabstopmode of the column in one row then it applies to all the cells of the column which is not desired in my case.

I need something that can bind to gridviewcell based the contained templated control inside the cell is enabled or not ?
I need to bind some property on the gridviewcell to IsEnabled property of the control.

Any suggestions would be appreciated..


Thanks.
0
Srikanth
Top achievements
Rank 1
answered on 14 Jan 2013, 11:11 PM
Any suggestions?
0
Dimitrina
Telerik team
answered on 15 Jan 2013, 03:16 PM
Hello,

In order to have the TabStop be specific for the GridViewCell, you can define a Style controlling the "IsEnabled" property for the GridViewCell via a Binding to a property of the bound business object. It will be applied per item (cell from the column) and allow/deny the TabStop on that cell.

For example I have defined a property IsEnabled for the bound item and this is the code I have used to control the enabled state per GridViewCell:

<Style x:Key="disabledStyle" TargetType="telerik:GridViewCell">
   <Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
</Style>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" CellStyle="{StaticResource disabledStyle}">
    <telerik:GridViewColumn.CellTemplate>
        <DataTemplate >
            <TextBox Text="{Binding Name}"/>
        </DataTemplate>
    </telerik:GridViewColumn.CellTemplate>
</telerik:GridViewDataColumn>

I hope this can be applied to your solution.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Srikanth
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Srikanth
Top achievements
Rank 1
Share this question
or