 悬赏园豆:200
                [待解决问题]
                悬赏园豆:200
                [待解决问题] 
            
                 
        MainWindow内容:
<materialDesign:DialogHost
    x:Name="dialogHost"
    HorizontalContentAlignment="Center"
    VerticalContentAlignment="Center"
    DialogOpened="DialogHost_DialogOpened">
    <materialDesign:DialogHost.DialogContent>
        <dialog:DeviceDetail x:Name="deviceDetail" />
    </materialDesign:DialogHost.DialogContent>
    <Grid DockPanel.Dock="Bottom">
        <ScrollViewer
            x:Name="scrollViewer"
            HorizontalScrollBarVisibility="Auto"
            PreviewMouseWheel="Window_MouseWheel"
            VerticalScrollBarVisibility="Auto">
            <Canvas Name="mainCanvas" Width="2000" Height="1000">
                <Grid x:Name="MainGrid">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <device:Device_A Width="1000" Height="1000" />
                </Grid>
            </Canvas>
        </ScrollViewer>
    </Grid>
</materialDesign:DialogHost>
Device_A用户控件主要内容
 <StackPanel Grid.Column="0" Margin="5">
     <ItemsControl ItemsSource="{Binding EntrancePassway[0].ChildNodeList}">
         <ItemsControl.ItemTemplate>
             <DataTemplate>
                 <Border Width="100" Height="70" BorderThickness="1">
                     <Border.InputBindings>
                         <MouseBinding Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}" CommandParameter="{Binding}" MouseAction="LeftClick" />
                     </Border.InputBindings>
                     <materialDesign:Card Background="LightGray" UniformCornerRadius="0">
                         <materialDesign:Card.Content>
                             <TextBlock
                                 HorizontalAlignment="Center"
                                 VerticalAlignment="Center"
                                 Style="{StaticResource MaterialDesignHeadlineMediumTextBlock}"
                                 Text="{Binding DeviceId}" />
                         </materialDesign:Card.Content>
                     </materialDesign:Card>
                 </Border>
             </DataTemplate>
         </ItemsControl.ItemTemplate>
     </ItemsControl>
 </StackPanel>
为什么通过CommandParameter="{Binding}"将自身的上下文传递过去之后,就显示这样?

下面这个才是我的设备详情页面

我的需求是想点击设备之后将这个设备的对象传递到弹框里。琢磨半天一直都是图一那样,有没有大佬遇到过,是我使用方式不对还是怎么的?
换个想法,
点击设备:存储到一个变量里,
后将这个设备的对象传递到弹框:弹框从变量里拿信息,
类似于SelectedItem
dialogContent是一个xaml节点,不是一个设备对象
刚用这个ui框架,都是边用边学的,问gpt问了半天都没解决
– barbecue9o9 1年前