In my XAML page I have added some resource
<Page.Resources>
<Button x:Key="btn" Content="Test Button"></Button>
...
</Page.Resources>
In my code file I am calling this resource but getting runtime exception. Cant understand what happens. Please advice
Button btn = this.Resources["btn"] as Button;
if (btn != null)
{
MyPivotItem.Content = btn; // here I am getting the exception
// "Value does not fall within the expected range"
}
MyPivotItem.Content<-- is this a button? - Christian PhillipsMyPivotItemis aPivotItem, I am addingbtnasContent- Kalyan