Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I've a data template for a datagrid cell

XML
<DataGridTemplateColumn.CellTemplate>
                                       <DataTemplate>
                                           <TextBox Width="90" Text="{Binding Path=ApplicationPercentage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalContentAlignment="Center" Height="25">
                                               <TextBox.Style BasedOn="{StaticResource {x:Type TextBox}}">
                                                   <Style>
                                                       <Style.Triggers>
                                                           <DataTrigger Binding="Text.Length" Value="0">
                                                               <Setter Property="Text" Value="0"/>
                                                           </DataTrigger>
                                                       </Style.Triggers>
                                                   </Style>
                                               </TextBox.Style>
                                           </TextBox>
                                       </DataTemplate>
                                   </DataGridTemplateColumn.CellTemplate>


I want a functionality such that whenever the textbox text.lengrh gets 0 (i.e. text becomes null) the text should auto reset to 0.

But this is throwing a build error "Cannot set properties on property elements".

Help Please!!

Thanks,
Abhishek.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900