数据网格行选择 [英] Datagrid row Selecting
本文介绍了数据网格行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
当您在数据网格中选择一行时,该蓝色突出显示了吗?但这并没有突出显示行的整个宽度.我该怎么做才能使其突出显示整个行,而不仅仅是行中的文本?看到这是在wpf
我的数据网格中选择一行时发生的情况
Hi Guys,
When you select a row in a datagrid it does that blue highlight thing right? But it doesn''t highlight the whole width of the row. What can i do to make it highlight the whole row and not just the text in the row? See this is what happens when a row is selected in my datagrid in wpf
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static DataGrid.FocusBorderBrushKey}}" />
</Trigger>
</Style.Triggers>
</Style>
请帮帮我.
在此先感谢.
Please help me.
Thanks in Advance.
推荐答案
;
受保护的void LinkButton1_Click(对象发送者,EventArgs e)
{
aa =更新";
}
受保护的void GridView1_SelectedIndexChanging(对象发送者,GridViewSelectEventArgs e)
{
标签ll =(Label)GridView1.Rows [e.NewSelectedIndex] .FindControl("Label1");
如果(aa =="edit")
{
int a = ll.Text;
Label1.text = Color(蓝色");
Label2.text = Color(蓝色");
}
其他
{
con.Open();
SqlCommand CC =新的SqlCommand(从Bank_master中删除,其中bank_pk =''" + ll.Text +'',con);
SqlDataReader dr = CC.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
con.Close();
Response.Redirect(〜/Admin/Bank_master_view.aspx");
}
}
using System.Drawing;
protected void LinkButton1_Click(object sender, EventArgs e)
{
aa = "update";
}
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
Label ll = (Label)GridView1.Rows[e.NewSelectedIndex].FindControl("Label1");
if (aa == "edit")
{
int a = ll.Text;
Label1.text = Color("Blue");
Label2.text = Color("Blue");
}
else
{
con.Open();
SqlCommand CC = new SqlCommand("delete from Bank_master where bank_pk = ''" + ll.Text + "''", con);
SqlDataReader dr = CC.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
con.Close();
Response.Redirect("~/Admin/Bank_master_view.aspx");
}
}
我从没做过WPF.在Windows窗体中,DataGridViews具有名称为FullRowSelect
的布尔属性.如果设置为true
,则始终选择整行,而不仅仅是单元格.
也许您可以在某个地方放置
I never did WPF. In Windows Forms, DataGridViews have a boolean property with nameFullRowSelect
. If set totrue
, you always select the full row, not just a cell.
Maybe you could place a
<property value="true" />
?
这篇关于数据网格行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文