we often see any ajax based website where textbox is placed for searching data. when we write something in the textbox and when data is fetching then a spinner gif images is shown in the tex开发者_开发百科tbox with right align. i know this done via css. so how can i achieve the same effect in wpf where textbox will be there and user will write something in the textbox and when data will be fetch then a spinning gif image will show in the textbox with right align and when data fetch will be completed then image will be invisible. please guide me with sample code if possible. thanks
To get you started, look at Data Validation in WPF, specifically, look for the section on Providing Visual Feedback with the AdornedElementPlaceHolder
class in WPF.
<AdornedElementPlaceholder/>
It is my belief that this mechanism could be relatively easily adapted to solving your particular problem.
Edit: Additional info
In your case, you'll create a control template for a TextBox and assign that control template to your textbox element. This example varies from the example in the link by changing the TextBox
to an Image
element. The TextBox in the example in the link is the red character that represents some sort of validation error.
<ControlTemplate x:Key="validationTemplate">
<DockPanel>
<Image Source="<location of your animated gif>">
<AdornedElementPlaceholder/>
</DockPanel>
</ControlTemplate>
精彩评论