如何从父窗口获取子控件

时间:2014-11-03 09:00:46

标签: c# wpf telerik

我正在使用RadRibbon视图。在我的Ribbonview中有一些选项卡。当单击选项卡时,usercontrol将动态加载。在此选项卡旁边有一个带有按钮的功能区组。当我在组中单击此按钮时我正在尝试在usercontrol中显示一个面板。但是我没有从组按钮中获取面板按钮。如何从父窗口获取childcontrol(在usercontor中)?有人可以帮忙吗?

提前感谢

这是我的xaml代码

 <telerik:RadRibbonTab x:Name="rtbDevice" Cursor="Hand" Header="Devices" FontFamily="Arial" FontWeight="Bold" Margin="0,1,0,0" >

               <telerik:RadRibbonGroup  Header="Actions" FontWeight="Normal" Margin="0,0,0,-3" Height="95" VerticalAlignment="Top" Width="192" DataContext="DeviceViewModel">

                   <telerik:RadRibbonButton LargeImage="/Images/add-user.png"  Name="btnAddNewDevice" Command="{Binding ElementName=uctrlDeviceList, Path=DataContext.ShowPanelCmd}" 
                                           Size="Large" Text="New" Width="70" Cursor="Hand"

                                            >
                   </telerik:RadRibbonButton>
                   <StackPanel Margin="0,0,0,-5">
                       <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium"  
                                           SmallImage="/Images/Edit.png" Cursor="Hand"
                                           telerik:ScreenTip.Description="Select  datagrid row  and click edit"
                                           telerik:ScreenTip.Title="Edit" Command="{Binding EditDeviceCommand}" 
                                           Text="Edit" Height="19" />
                       <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium" Margin="0,4,0,0"
                        SmallImage="/Images/Duplicate.png" Cursor="Hand" 
                        telerik:ScreenTip.Description="Copy the selection and put it on the Clipboard."
                        telerik:ScreenTip.Title="Duplicate"
                        Text="Duplicate" Height="22" />
                       <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium" Margin="0,5,0,0" 
                                           SmallImage="/Images/Delete.png" Cursor="Hand" 
                                           telerik:ScreenTip.Description="Copy formatting from one place and apply it to another.Double-click this button to apply the same formatting to multiple places in the document."
                                           telerik:ScreenTip.Title="Delete"
                                           Text="Delete" RenderTransformOrigin="0.452,0.909" Height="13" />
                   </StackPanel>
               </telerik:RadRibbonGroup>

           </telerik:RadRibbonTab>

0 个答案:

没有答案