How do I set a string type or int type to a button in a metro app?
I have tried the below code,
<Button Name="oldlogs" Tag="old"
Content="New Logs" HorizontalAlignment="Left"
Margin="819,660,0,0" VerticalAlignment="Top"
Click="showNewLogs"/>
but when I check
if (oldlogs.Tag == "old") {
addedVal++;
flag = 1;
showLog(sender, e);
}
The control doesnt enter the if loop! Kindly help through.
Tag stores an object.
You need to cast it to string and then compare it with “old” literal.