I have created custom Dependency Property for Window class. And I'm setting this property on TextBox in xaml as shown in code below. The SampleProperty class extends the Windows class and not Stackpanel.
<StackPanel l:SampleProperty.IsSamplePropertyField="true"/>
How do I set this property from my code behind?
When you defined the attached property you created static getter and setters methods, which you can use in your code:
SampleProperty.SetIsSamplePropertyField(myStackPanel, true);