Click here to Skip to main content
15,905,420 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a button

<Button Name="btnSaveMapping" Click="btnSaveMapping_Click">
      <StackPanel Orientation="Horizontal" >
            <Image Source="Images/save_24.png" Height="23" Width="23"></Image>
            <TextBlock>Save Mapping</TextBlock>
      </StackPanel>
</Button>


I want to change the button content to "Update Mapping". How can I do this.

Please help.
Thanks
Posted

You can give the controls names with x:Name = "xxx" and then access them by name in your code.
 
Share this answer
 
Comments
nit_singh 17-Jun-11 3:45am    
Hi Christian, Thanks it is working but is there any other way to change the content?
The proper way to do this is via binding.
Bind the TextBlock text to a property and update the source, this will change the Textblock value.
 
Share this answer
 
Comments
nit_singh 17-Jun-11 3:47am    
can you give an example?
Abhinav S 17-Jun-11 3:50am    
How about this?
nit_singh 17-Jun-11 3:53am    
Thanks
Sergey Alexandrovich Kryukov 17-Jun-11 3:57am    
Good, my 5.
--SA
Abhinav S 17-Jun-11 4:09am    
Thank you SA.

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