问题描述
< ListView Name ="GridViewUtente";保证金="24、53、33、0"; VerticalAlignment =顶部" Grid.ColumnSpan ="3". Grid.RowSpan ="2". Grid.Row ="1">
< ListView.View>
< GridView AllowsColumnReorder ="true">
< GridViewColumn Header ="ID" DisplayMemberBinding =""{Binding ID}" Width ="{Binding AppliesToColumnVisible,Converter = {StaticResource BooleanToVisibilityConverter}}" />
< GridViewColumn Header ="Nome" DisplayMemberBinding =""{Binding Nome}" />
< GridViewColumn Header ="Cognome" DisplayMemberBinding =""{Binding Cognome}" />
< GridViewColumn Header ="Data di Nascita" DisplayMemberBinding =< {Binding DataNascita,StringFormat ='dd/MM/yyyy'}'" />
< GridViewColumn Header ="Luogo di Nascita"; DisplayMemberBinding =" {Binding LuogoNascita}" />
< GridViewColumn Header ="Email" DisplayMemberBinding =" {Binding Email}"/>
< GridViewColumn Header ="Sesso" DisplayMemberBinding =""{Binding Sesso}" />
< GridViewColumn Header ="Password" DisplayMemberBinding =""{Binding Psw}" />
< GridViewColumn标头="Elimina">
< GridViewColumn.CellTemplate>
< DataTemplate>
< Button样式=""{StaticResource MaterialDesignFloatingActionMiniLightButton}}"背景=#FFDA0F0F"; BorderBrush =#FF952006"
HorizontalAlignment =中心". VerticalAlignment =顶部" Grid.Column ="1".宽度="25". 身高="25"
ToolTip ="Elimina Utente".点击="btnAdd_Click"前景=#DDFFFFFF" RenderTransformOrigin ="0.415,1.037". CommandParameter =" {Binding ID}">
< materialDesign:PackIcon Kind ="AccountRemove"高度="18".宽度="18"/
</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
< GridViewColumn标头="Modifica">
< GridViewColumn.CellTemplate>
< DataTemplate>
< Button样式=""{StaticResource MaterialDesignFloatingActionMiniLightButton}}"背景=#FFD7EC08"; BorderBrush =#FFA3AA04"
HorizontalAlignment =中心". VerticalAlignment =顶部" Grid.Column ="1".宽度="25". 身高="25"
ToolTip ="Modifica Utente".点击="btnAdd_Click"前景=#DD000000" RenderTransformOrigin ="0.415,1.037". CommandParameter =" {Binding ID}">
< materialDesign:PackIcon Kind ="AccountSettingsVariant"高度="18".宽度="18"/
</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<ListView Name="GridViewUtente" Margin="24,53,33,0" VerticalAlignment="Top" Grid.ColumnSpan="3" Grid.RowSpan="2" Grid.Row="1">
<ListView.View>
<GridView AllowsColumnReorder="true">
<GridViewColumn Header="ID" DisplayMemberBinding="{Binding ID}" Width= "{Binding AppliesToColumnVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<GridViewColumn Header="Nome" DisplayMemberBinding="{Binding Nome}" />
<GridViewColumn Header="Cognome" DisplayMemberBinding="{Binding Cognome}" />
<GridViewColumn Header="Data di Nascita" DisplayMemberBinding="{Binding DataNascita, StringFormat='dd/MM/yyyy'}" />
<GridViewColumn Header="Luogo di Nascita" DisplayMemberBinding="{Binding LuogoNascita}" />
<GridViewColumn Header="Email" DisplayMemberBinding="{Binding Email}" />
<GridViewColumn Header="Sesso" DisplayMemberBinding="{Binding Sesso}" />
<GridViewColumn Header="Password" DisplayMemberBinding="{Binding Psw}" />
<GridViewColumn Header="Elimina">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}" Background="#FFDA0F0F" BorderBrush="#FF952006"
HorizontalAlignment="Center" VerticalAlignment="Top" Grid.Column="1" Width="25" Height="25"
ToolTip="Elimina Utente" Click="btnAdd_Click" Foreground="#DDFFFFFF" RenderTransformOrigin="0.415,1.037" CommandParameter="{Binding Id}">
<materialDesign:PackIcon Kind="AccountRemove" Height="18" Width="18"/>
</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Modifica">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}" Background="#FFD7EC08" BorderBrush="#FFA3AA04"
HorizontalAlignment="Center" VerticalAlignment="Top" Grid.Column="1" Width="25" Height="25"
ToolTip="Modifica Utente" Click="btnAdd_Click" Foreground="#DD000000" RenderTransformOrigin="0.415,1.037" CommandParameter="{Binding Id}">
<materialDesign:PackIcon Kind="AccountSettingsVariant" Height="18" Width="18"/>
</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
推荐答案
1. 什么不起作用或起作用了. 您确实没有提出问题.
1. what is not working or is it working. You really did not ask a question.
2.可以在ItemsSource中找到ID(如果这就是行ID的含义). XAML不会显示ItemsSource的绑定,但是由于列具有绑定,所以我只能假定您在代码中提供了ItemsSource.
2. the ID (if that is what you meant by Row ID) can be found in the ItemsSource. The XAML does not show a binding for the ItemsSource but since the columns have bindings I can only assume you are providing the ItemsSource in code.
3. 更新数据库(您不说哪个数据库)是API的功能(您再也没有告诉我们),并且通常使用DataGrid而不是ListView进行简单的编辑. 实体框架会非常简单.
3. Updating a DB (you don't say which DB) is a function of the API (which again you haven't told us) and a DataGrid rather than a ListView is generally used for simple editing. Entity Framework would be very simple.
这篇关于如何隐藏列以及如何在DB Nell WPF中读取行ID以对其进行编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!