Datagrid列定义silverlight问题

发布于 2024-10-15 03:18:11 字数 2248 浏览 0 评论 0原文

在XAML中:

错误 1 ​​类型“DataGridTextColumn” 不支持直接

我想在datagridview的列的每一行添加一个按钮 在数据网格中

查看:

<UserControl x:Class="Paradigma.Silverlight.DiccionarioDatos.UserControlAdminEmpleados"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:ig="http://schemas.infragistics.com/xaml"
    mc:Ignorable="d"
    d:DesignHeight="469" d:DesignWidth="641" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Background="White">
        <ListBox Height="145" HorizontalAlignment="Left" Margin="12,32,0,0" Name="lbEmpleado" VerticalAlignment="Top" Width="267" />
        <ListBox Height="145" HorizontalAlignment="Right" Margin="0,32,100,0" Name="lbRoles" VerticalAlignment="Top" Width="256" />
        <Button Content="Agregar" Margin="0,32,11,0" Name="butAgregar" Click="butAgregar_Click" HorizontalAlignment="Right" Width="83" Height="145" VerticalAlignment="Top" />
        <sdk:DataGrid AutoGenerateColumns="False" Height="230" Margin="11,0,11,47" Name="dgRelaciones" VerticalAlignment="Bottom">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Empleado" IsReadOnly="False" Width="Auto" Binding="{Binding Empleado.Nombre}"/>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Rol" IsReadOnly="False" Width="Auto" Binding="{Binding Rol.Nombre}"/>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Acciones" IsReadOnly="False" Width="Auto" >
                    <StackPanel />

                </sdk:DataGridTextColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>
</UserControl>

in xaml :

Error 1 The type 'DataGridTextColumn'
does not support direct

I want to add a button in each row in a column in a datagridview
in a datagrid

Look:

<UserControl x:Class="Paradigma.Silverlight.DiccionarioDatos.UserControlAdminEmpleados"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:ig="http://schemas.infragistics.com/xaml"
    mc:Ignorable="d"
    d:DesignHeight="469" d:DesignWidth="641" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Background="White">
        <ListBox Height="145" HorizontalAlignment="Left" Margin="12,32,0,0" Name="lbEmpleado" VerticalAlignment="Top" Width="267" />
        <ListBox Height="145" HorizontalAlignment="Right" Margin="0,32,100,0" Name="lbRoles" VerticalAlignment="Top" Width="256" />
        <Button Content="Agregar" Margin="0,32,11,0" Name="butAgregar" Click="butAgregar_Click" HorizontalAlignment="Right" Width="83" Height="145" VerticalAlignment="Top" />
        <sdk:DataGrid AutoGenerateColumns="False" Height="230" Margin="11,0,11,47" Name="dgRelaciones" VerticalAlignment="Bottom">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Empleado" IsReadOnly="False" Width="Auto" Binding="{Binding Empleado.Nombre}"/>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Rol" IsReadOnly="False" Width="Auto" Binding="{Binding Rol.Nombre}"/>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Acciones" IsReadOnly="False" Width="Auto" >
                    <StackPanel />

                </sdk:DataGridTextColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>
</UserControl>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぃ双果 2024-10-22 03:18:11

我使用的是 sdk:DataGridTextColumn,而不是 sdk:DataGridTemplateColumn :S

<sdk:DataGrid AutoGenerateColumns="False" Height="230" Margin="11,0,11,47" Name="dgRelaciones" VerticalAlignment="Bottom">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Empleado" IsReadOnly="False" Width="Auto" Binding="{Binding Empleado.Nombre}"/>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Rol" IsReadOnly="False" Width="Auto" Binding="{Binding Rol.Nombre}"/>
                <sdk:DataGridTemplateColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Acciones" IsReadOnly="False" Width="Auto" >
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <!--ELEMENTS HERE-->
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>

它可以工作

I was using the sdk:DataGridTextColumn, not the sdk:DataGridTemplateColumn :S

<sdk:DataGrid AutoGenerateColumns="False" Height="230" Margin="11,0,11,47" Name="dgRelaciones" VerticalAlignment="Bottom">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Empleado" IsReadOnly="False" Width="Auto" Binding="{Binding Empleado.Nombre}"/>
                <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Rol" IsReadOnly="False" Width="Auto" Binding="{Binding Rol.Nombre}"/>
                <sdk:DataGridTemplateColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Acciones" IsReadOnly="False" Width="Auto" >
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <!--ELEMENTS HERE-->
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>

it works

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文