In my application I am using a style to a listbox. In that style there is a button. I want to change the content of the button. The xaml shows below
<Style x:Key="ListBoxStyle" TargetType="ListBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<ScrollViewer x:Name="ScrollViewer">
<StackPanel>
<ItemsPresenter/>
<Button Content="Load More..." Name="btnLoadMore" Click="btnLoadMore_Click"></Button>
</StackPanel>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
How can I programmatically change the button content
You can bind to that Dependency Property to flow whatever between the UI & the data object. A good explanation can be found in the docs here reagarding Data Binding and multiple tutorials available. Hope this helps.