问题
Please, help me:
If I have a TextBox in a HubSection, how I can get data from it if the Grid that I have the TextBox is in a DataTemplate?,
<Hub Style="{StaticResource HubStyle1}">
<Hub.Header>
<!-- Some stuff here -->
</Hub.Header>
<HubSection Width="731" Style="{StaticResource HubSectionStyle1}">
<DataTemplate>
<Grid FlowDirection="RightToLeft" Margin=" 0,10,0,0" >
<TextBox
Grid.Row="0"
Grid.Column="1"
Style="{StaticResource AddTextBlockStyle}" />
</Grid>
</DataTemplate>
</HubSection>
</Hub>
回答1:
handle the Loaded
event for any of the elements and the sender parameter will be that element. Save the parameter for later access.
回答2:
Go through This question How do I access a control inside a XAML DataTemplate
if you are trying to acccess element inside template
来源:https://stackoverflow.com/questions/20846807/access-data-inside-hubsection