9

DataGridTextColumn の MaxLength プロパティを設定するにはどうすればよいですか?

4

3 に答える 3

3

すべての列でスタイルを共有していて、そのうちの 1 つ以上にスタイルを追加したい場合は、Style.BasedOn プロパティを使用できます。

 <DataGridTextColumn Binding="{Binding SomeProperty, UpdateSourceTrigger=PropertyChanged}" ElementStyle="{StaticResource CellErrorStyle}">
     <DataGridTextColumn.EditingElementStyle>
           <Style TargetType="TextBox" BasedOn="{StaticResource OriginalStyleKey}">
                <Setter Property="MaxLength" Value="5" />                            
           </Style>
     </DataGridTextColumn.EditingElementStyle>
 </DataGridTextColumn>
于 2014-02-19T14:58:42.583 に答える