[英]Windows 8.1 app How to access control within BottomAppBar flyout?
x:Name does not work on user controls that are within a flyout that is a child element of a page's BottomAppBar. x:名称不适用于作为页面BottomAppBar的子元素的弹出窗口内的用户控件。 I'm trying to access this custom userControl from the code behind.
我正在尝试从后面的代码访问此自定义userControl。 Any ideas how this can be done?
有什么想法可以做到这一点?
<Page.BottomAppBar>
<AppBar IsOpen="{Binding AppBarOpen,
Mode=TwoWay}"
IsSticky="{Binding AppBarSticky,
Mode=TwoWay}">
<Grid>
<!--Other controls and whatnot here including column specifications and leftpanel stuff-->
<VariableSizedWrapGrid x:Name="appbarrightPanel"
Grid.Column="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<AppBarButton x:Name="appbarbtnUpload"
Click="appbarbtnUpload_Click"
Label="Upload">
<AppBarButton.Icon>
<BitmapIcon Width="22"
Height="22"
UriSource="ms-appx:///Assets/TopAppbarIcons/icon_upload.png" />
</AppBarButton.Icon>
<FlyoutBase.AttachedFlyout>
<Flyout>
<usercontrols:UploadControl x:Name="uploadControl" ParentPage="Tag List Page" FileChoosen="UploadControl_FileChoosen" Margin="-20"/>
</Flyout>
</FlyoutBase.AttachedFlyout>
</AppBarButton>
</VariableSizedWrapGrid>
</Grid>
</AppBar>
</Page.BottomAppBar>
Again, doing uploadControl.blah does not work because I cannot even access uploadControl. 再次,uploadControl.blah不起作用,因为我甚至无法访问uploadControl。
I wasn't able to directly connect to it via it's name BUT I was able to hook into it's Loaded and Unloaded events to access it. 我无法通过它的名称直接连接到它但是我能够挂钩它的Loaded和Unloaded事件来访问它。 You can probably get the object itself by casting the sender object.
您可以通过转换发送方对象来获取对象本身。 Just being able to access the object in the onLoad was good enough for my purposes.
只是能够访问onLoad中的对象对我的目的来说已经足够了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.