tags:

views:

109

answers:

1

I am binding the data of a textbox through databinding. Instead of giving the minimum and maximum value like this ...

<TextBox Height="24" 
         HorizontalAlignment="Right" 
         abc:TextBoxMaskBehaviour.Mask="Decimal" 
         abc:TextBoxMaskBehaviour.MinimumValue="0" 
         abc:TextBoxMaskBehaviour.MaximumValue="200"
         Margin="0,9,8.5,0" Name="txtCStart" 
         VerticalAlignment="Top" 
         Width="106" 
         MouseWheel="OnMouseWheel">

I want to give it throught .xaml.cs file. How to do that? Help me please

+4  A: 

Apparently (judging from your comments, your question is not very clear), you want to set the abc:TextBoxMaskBehaviour.MinimumValue and MaximumValue through C# code:

TextBoxMaskBehaviour.SetMinimumValue(txtCStart, 0);
TextBoxMaskBehaviour.SetMaximumValue(txtCStart, 200);

In general, you set attached properties like this: AttachedPropertyClass.SetAttachedProperty(Control, Value). Likewise, the value can be read with AttachedPropertyClass.GetAttachedProperty(Control).

Heinzi
thanks ya.. it works:)
You're welcome, glad I could help. Feel free to mark this as accepted answer (click on the "check icon" next to the answer).
Heinzi