tags:

views:

51

answers:

2

Here is what i am trying to do

private ToggleButton _itemChecked=Name_Of_Element_In_Xaml;

That doesnt work. Is there a way?

A: 

You don't have to create it in the code behind if you already named it in xaml.

If you do this in xaml:

<Grid x:Name="LayoutRoot">
    <ToggleButton x:Name="myToggleButton"></ToggleButton>
</Grid>

You can do this in code behind:

public MainPage()
{
    InitializeComponent();
    myToggleButton.Content = "Toggle Me";
}

Cheers, Phil

Phil
A: 

I found a way to do it.

private ToggleButton _itemChecked=FindName("Name_Of_Element_In_Xaml");