我有一个datagrid,其中一列作为DataGridTemplateColumn,如下所示:
<my:DataGrid Name="dgvSales" RowHeight="23" SelectionUnit="Cell" BeginningEdit="dgvSales_BeginningEdit" AutoGenerateColumns="False" CellEditEnding="dgvSales_CellEditEnding" >
<my:DataGrid.Columns>
<my:DataGridTemplateColumn Header="Product Name" Width="200">
<my:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Product_Name}"></TextBlock>
</DataTemplate>
</my:DataGridTemplateColumn.CellTemplate>
<my:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox x:Name="txtbxProduct" Text="{Binding Product_Name}" TextChanged="txtbxProduct_TextChanged" KeyDown="txtbxProduct_KeyDown"></TextBox>
</DataTemplate>
</my:DataGridTemplateColumn.CellEditingTemplate>
</my:DataGridTemplateColumn>
</my:DataGrid.Columns>
</my:DataGrid>
Run Code Online (Sandbox Code Playgroud)
当单元格值更改时,我想将一些项目填充到列表视图中,TextChanged事件如下:
private void txtbxProduct_TextChanged(object sender, TextChangedEventArgs e)
{
TextBox tb = (TextBox)sender;
if (tb.Text.Trim() != "")
{
string qry = "select PL.Record_Id as PList_Id,PM.Record_Id as Product_Id,PM.Product_Code,PM.Product_Name,PTM.Product_Type,PL.Purchase_Rate ,PL.Selling_Rate,PL.MRP from dbo.Tbl_Product_Master PM join Tbl_Product_List PL on PL.Product_Id=PM.Record_Id join Tbl_Product_Type_Master PTM on PTM.Record_Id=PM.Product_Category_Id where PL.Batch_Flag=0 and PM.Is_Del='false'and PM.Is_Active='true' and …Run Code Online (Sandbox Code Playgroud) 我要求我创建一个只接受数值(整数)的datagridcolumn,当用户输入除数字之外的其他内容处理文本框时.我尝试了很多网页,我厌倦了这些,我非常感谢任何有帮助的人.
我有一个数据网格说Datagrid1,其中填充了List(动态地通过代码隐藏).在datagrid的行详细信息模板里面,我想添加一个datagrid,让我们调用datagrid2,datagrid2需要在Datagrid1的SelectionChange事件上用List动态地进行poupulated?访问datagrid2并将其绑定到数据源需要在后面的代码中完成.可以用这个来帮助我吗?我的xaml是:
<Grid>
<my:DataGrid Name="dataGrid1" ItemsSource="{Binding}">
<my:DataGrid.RowDetailsTemplate>
<DataTemplate>
<my:DataGrid Name="dataGrid2"></my:DataGrid>
</DataTemplate>
</my:DataGrid.RowDetailsTemplate>
</my:DataGrid>
</Grid>
Run Code Online (Sandbox Code Playgroud) 在我的Web API应用程序中,我实现了OAuth2。在ApplicationOAuthProvider的GrantResourceOwnerCredentials上,我正在调用我的自定义成员资格服务以登录并获取令牌。问题是我必须将成员资格服务注入ApplicationOAuthProvider才能使用该服务,但由于owinStartup类的原因而不允许使用它不支持参数构造函数。如何在GrantResourceOwnerCredentials方法中注入/使用我的成员资格服务。
public class ApplicationOAuthProvider : OAuthAuthorizationServerProvider
{
private readonly string _publicClientId;
private readonly IMembershipService _membershipService;
public ApplicationOAuthProvider(string publicClientId,
IMembershipService membershipService)
{
if (publicClientId == null)
{
throw new ArgumentNullException("publicClientId");
}
_publicClientId = publicClientId;
this._membershipService = membershipService;
}
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
AccountLogin LogCredentials = new AccountLogin();
LogCredentials.UserName = context.UserName;
LogCredentials.Password = context.Password;
ProviderLoginResponse providerLoginResponse =
_membershipService.UserLogin(LogCredentials);
if (providerLoginResponse.LoginStatus != "Y")
{
context.SetError("invalid_grant", "The user name or password
is incorrect.");
return;
}
var claims = new List<Claim>() …Run Code Online (Sandbox Code Playgroud) asp.net-mvc dependency-injection oauth-2.0 asp.net-web-api owin
c# ×3
datagrid ×3
wpf ×3
asp.net-mvc ×1
oauth-2.0 ×1
owin ×1
validation ×1
wpftoolkit ×1
xaml ×1