I designed a project that has user defined controls with datagrids. Some columns of control's datagrid are DataGridTextColumn with twoway binding (to read and write data from/to binding model). Some cells of DataGridTextColumn contains very long text and can't be succesfully displayed in cell. I've decide to put scrollbars in this cells. Every cell column contains some user defined style, so I create my own with DataGridCell template replacment. Here it is:
<Style x:Key="DataGridTextColumnWithScrollBar" TargetType="{x:Type Control}" BasedOn="{StaticResource {x:Type wpf_toolkit:DataGridCell}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Control}">
<ContentPresenter Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content, Mode=TwoWay}">
<ContentPresenter.ContentTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=Text, Mode=TwoWay}"
TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"
VerticalAlignment="Stretch" Margin="2,0" BorderThickness="0"/>
</DataTemplate>
</ContentPresenter.ContentTemplate>
</ContentPresenter>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Style DataGridTextColumnWithScrollBar merged with base datagrid text column cell style. It works fine, but I can't edit text(all scrolls appears, but after text was edited, model doesn't updates). Is there any solutions to resolve my problem? I tried many ways (for example, WPF Nested binding in a controltemplate) but nothing works...
P.S. I cannot change datagridtext column to datatemplate textcolumn because controls are stored in external dll library.
Thanks in advance.
WPF Toolkit
you are using? – pushpraj