Access Data Inside HubSection

喜欢而已 提交于 2019-12-24 03:06:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!