The problem:
This will not work in Code behind for below Button UI :
string strButtonText = btnConfirm.Content.ToString();
your help is greatly appreciated. TIA
<Button x:Name="btnConfirm" Background="Crimson" Foreground="White" FontSize="21" HorizontalAlignment="Left" Margin="662,640,0,0" VerticalAlignment="Top" Height="93" Width="166" Click="btnConfirm_Click"> <TextBlock Text="Begin" TextWrapping="Wrap" Width="138" Height="61" /> </Button> The code only work for normal buttun UI: <Button x:Name="btnConfirm" content="Begin" Background="Crimson" Foreground="White" FontSize="21" HorizontalAlignment="Left" Margin="662,640,0,0" VerticalAlignment="Top" Height="93" Width="166" Click="btnConfirm_Click /> Update : How to you set the text back to the button UI in code ?? if (strButtonText.Contains("Begin Date") || strButtonText.Contains("Begin")) { ??? btnConfirm.Content = "End Date"; } else { ?? btnConfirm.Content = "Begin"; }