Syncfusion,Inc。成立于2001年,为Microsoft .NET平台提供广泛的企业级软件组件和工具。 Syncfusion还支持各种平台,如:Angular,jQuery,Xamrin等。更多信息请访问:https://www.syncfusion.com/
如何获取 SfDataGrid 控件中 CellLongPress 事件的 e.RowColumnIndex 值?
我从Syncfusion找到了一个DatGrid控件,并将其设置如下: 我从 Syncfusion 找到了一个 DatGrid 控件,并将其设置如下: <syncfusion:SfDataGrid x:Name="PasswdVw" Grid.Row="2" Grid.Column="2" Grid.RowSpan="2" ItemsSource="{Binding PassWrd}" SelectedRow="{Binding SelPassRws, Mode=TwoWay}" GridLinesVisibility="Both" SelectionMode ="Multiple" NavigationMode="Row" HeaderRowHeight="35" MaximumWidthRequest="1400" Margin="20,0,0,0" CellLongPress="PasswdVw_CellLongPress"> 我想做的只是在单击某一列时才运行代码。所以在后面的代码中我有这个: private void PasswdVw_CellLongPress(object sender, DataGridCellLongPressEventArgs e) { if(e.RowColumnIndex != 3) { return; } // continue with code here. } 但我总是在 e.RowColumnIndex 行收到错误消息: 那么我如何使用我点击的相应列号或MappingName? 根据文档,RowColumnIndex类的DataGridCellLongPressEventArgs属性属于同名的RowColumnIndex类,它包含两个整数字段:RowIndex和ColumnIndex,每个类型都是System.Int32(或 int)。 因此,您不能将RowColumnIndex与整数进行比较,而只能将其成员与其他整数进行比较,例如: private void PasswdVw_CellLongPress(object sender, DataGridCellLongPressEventArgs e) { if(e.RowColumnIndex.ColumnIndex != 3) { return; } // continue with code here. }
我在 .NET MAUI 应用程序中使用 Syncfusion 的数据网格控件,现在我想更新用户单击的单个单元格。在 XAML 代码中我有这样的: 我在 .NET MAUI 应用程序中使用 Syncfusion 的数据网格控件,现在我想更新用户单击的单个单元格。在 XAML 代码中我有这个: <syncfusion:SfDataGrid x:Name="PasswdVw" ItemsSource="{Binding PassWrd}" SelectedRow="{Binding SelPassRws, Mode=TwoWay}" SelectionMode ="Multiple" NavigationMode="Row" HeaderRowHeight="35" CellLongPress="PasswdVw_CellLongPress"> <syncfusion:SfDataGrid.Columns> <syncfusion:DataGridTextColumn MappingName="PassId" Visible="False"/> <syncfusion:DataGridTemplateColumn MappingName="PassTitle" HeaderText="Title" CellPadding="3" HeaderTextAlignment="Center" ColumnWidthMode="FitByCell"> <syncfusion:DataGridTemplateColumn.CellTemplate> <DataTemplate> <local:HyperlinkLabel Text="{Binding PassTitle}" BackgroundColor="White" Url="{Binding PassUrl}"/> </DataTemplate> </syncfusion:DataGridTemplateColumn.CellTemplate> </syncfusion:DataGridTemplateColumn> <syncfusion:DataGridTextColumn MappingName="PassUsrname" HeaderText="User Name" HeaderTextAlignment="Center" ColumnWidthMode="FitByCell"/> <syncfusion:DataGridTextColumn MappingName="PassPassword" HeaderText="Password" HeaderTextAlignment="Center" Width="150"/> <syncfusion:DataGridTextColumn MappingName="PassUrl" Visible="False"/> <syncfusion:DataGridTextColumn MappingName="PassGrpName" HeaderText="Group" HeaderTextAlignment="Center" ColumnWidthMode="FitByCell"/> <syncfusion:DataGridTextColumn MappingName="PassNotes" HeaderText="Notes" Width="100" HeaderTextAlignment="Center"/> </syncfusion:SfDataGrid.Columns> </syncfusion:SfDataGrid> 我的 CellLongPress 事件的幕后代码是: private void PasswdVw_CellLongPress(object sender, DataGridCellLongPressEventArgs e) { if(e.RowColumnIndex.ColumnIndex == 3) { var passData = e.RowData as PasswrdInfo; string tmpPass, newPass; using(SqlConnection c = new SqlConnection(App.ConnStr)) { string query = "select password from PassWrds where Id = " + passData.PassId; using(SqlCommand cmd = c.CreateCommand()) { c.Open(); tmpPass = cmd.ExecuteScalar().ToString(); c.Close(); } } newPass = Crypto.Decrypt(App.secretKey, tmpPass); } } 所以现在我想将单击的单元格设置为 newPass。 我尝试了 PasswdVw[e.RowColumnIndex.RowIndex].Cell[3] 和其他类似的东西,以及玩弄 e.RowColumnIndex.RowIndex 和 e.RowColumnIndex.ColumnIndex 但我只是不断收到错误。 如何将单击的单元格设置为名为 newPass 的变量? 如果你的 PasswrdInfo 类是 observable,假设它看起来像这样: public partial class PasswrdInfo : ObservableObject { [ObservableProperty] private int passId; [ObservableProperty] private string passTitle; [ObservableProperty] private string passUsrname; [ObservableProperty] private string passPassword; // etc. } 您可以简单地将 newPass 分配给 passData.PassPassword: private void PasswdVw_CellLongPress(object sender, DataGridCellLongPressEventArgs e) { if(e.RowColumnIndex.ColumnIndex == 3) { var passData = e.RowData as PasswrdInfo; string tmpPass, newPass; // skipping some code for brevity newPass = Crypto.Decrypt(App.secretKey, tmpPass); // if PasswrdInfo is observable, this should suffice passData.PassPassword = newPass; } } 这应该会自动更新 SfDataGrid 的选定单元格中的数据。
我有一个网格,可以在其中输入数据,并且根据列中的值需要创建重定向到另一个网格的超链接在毛伊岛Syncfusion
“我有一个网格,可以在其中输入数据,根据列中的值,我需要创建重定向到另一个网格的超链接。”在毛伊岛 Syncfusion 在毛伊岛 SyncfusionIi 需要
我有一个.net项目,它在docker-compose中运行。 因此,我将 Syncfusion.HtmlToPdfConverter.Net.Linux 用于 .net core 应用程序。 使用 Microsoft.AspNetCore.Mvc; 使用 Syncfusion。
我可以将 DataGrid 中的 DataGridText 列格式化为超链接吗?
我的 XAML 代码中有一个 DataGrid 定义了以下内容: 我的 XAML 代码中有一个 DataGrid 定义了以下内容: <syncfusion:SfDataGrid x:Name="PasswdVw" Grid.Row="2" Grid.Column="2" Grid.RowSpan="2" ItemsSource="{Binding PassWrd}" SelectedRow="{Binding SelPassRws, Mode=TwoWay}" GridLinesVisibility="Both" SelectionMode ="Multiple" NavigationMode="Row" Margin="20,20,0,0" HeaderRowHeight="35" ColumnWidthMode="Fill" VerticalScrollBarVisibility="Always" SortingMode="Single"> <syncfusion:SfDataGrid.DefaultStyle> <syncfusion:DataGridStyle RowBackground="white" SelectedRowTextColor="White" SelectionBackground="blue" HeaderRowBackground="#C5C5C5" HeaderRowTextColor="Black" HeaderRowFontAttributes="Bold"/> </syncfusion:SfDataGrid.DefaultStyle> <syncfusion:SfDataGrid.Columns> <syncfusion:DataGridTextColumn MappingName="PassId" Width="0"/> <syncfusion:DataGridTextColumn MappingName="PassUsrname" HeaderText="User Name"/> <syncfusion:DataGridTextColumn MappingName="PassPassword" HeaderText="Password" Width="150"/> <syncfusion:DataGridTextColumn MappingName="PassUrl" HeaderText="Web Site"/> </syncfusion:SfDataGrid.Columns> </syncfusion:SfDataGrid> 当我运行程序时,MappingName="PassUrl" 列始终填充网站地址。但是,它们仅显示为文本字符串。有没有办法将这些字符串转换为可点击的超链接? 此外,是否有一种方法可以手动调整列的大小,以便用户可以根据自己的需要在运行时调整每列的大小? 您可以使用 TapGestureRecognizer 创建超链接。 以下是创建超链接的步骤: 设置 Label 或 Span 的 TextColor 和 TextDecoration 属性。 将 TapGestureRecognizer 添加到 GestureRecognizers 集合中 Label 或 Span,其 Command 属性绑定到 ICommand,以及 其 CommandParameter 属性包含要打开的 URL。 定义将由 执行的 ICommand TapGestureRecognizer。 编写将由ICommand执行的代码。 这是代码示例: <Label> <Label.FormattedText> <FormattedString> <Span Text="Alternatively, click " /> <Span Text="here" TextColor="Blue" TextDecorations="Underline"> <Span.GestureRecognizers> <TapGestureRecognizer Command="{Binding TapCommand}" CommandParameter="https://learn.microsoft.com/dotnet/maui/" /> </Span.GestureRecognizers> </Span> <Span Text=" to view .NET MAUI documentation." /> </FormattedString> </Label.FormattedText> </Label> 当点击超链接时,TapGestureRecognizer 将通过执行其 ICommand 属性定义的 Command 进行响应。此外,由 CommandParameter 属性指定的 URL 将作为参数传递给 ICommand。 XAML 页面的代码隐藏包含 TapCommand 实现: using System.Windows.Input; public partial class MainPage : ContentPage { // Launcher.OpenAsync is provided by Essentials. public ICommand TapCommand => new Command<string>(async (url) => await Launcher.OpenAsync(url)); public MainPage() { InitializeComponent(); BindingContext = this; } } 要将“PassUrl”列中的字符串转换为可点击的超链接,您可以使用 DataGridTemplateColumn 并在其中定义 HyperlinkButton。这是一个例子: <syncfusion:DataGridTemplateColumn MappingName="PassUrl" HeaderText="Web Site"> <syncfusion:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="{Binding PassUrl}"> <Button.Template> <ControlTemplate> <HyperlinkButton Content="{Binding PassUrl}" NavigateUri="{Binding PassUrl}" TargetName="_blank"/> </ControlTemplate> </Button.Template> </Button> </DataTemplate> </syncfusion:DataGridTemplateColumn.CellTemplate> </syncfusion:DataGridTemplateColumn> 在此示例中,DataGridTemplateColumn 用于为“PassUrl”列中的每个单元格定义自定义模板。在模板内部,Button 用作 HyperlinkButton 的容器。 HyperlinkButton 绑定到 PassUrl 属性,并将 NavigateUri 设置为相同的属性。将 TargetName 设置为“_blank”将在新选项卡或窗口中打开链接。 关于手动调整列大小,Syncfusion 的 SfDataGrid 控件提供了对列大小调整的内置支持。要启用手动调整大小,您可以将每列的 ColumnSizer 属性设置为“自动”。这允许用户根据自己的需要在运行时调整列的大小。这是一个例子: <syncfusion:DataGridTextColumn MappingName="PassUsrname" HeaderText="User Name" ColumnSizer="Auto"/> <syncfusion:DataGridTextColumn MappingName="PassPassword" HeaderText="Password" Width="150" ColumnSizer="Auto"/> <syncfusion:DataGridTextColumn MappingName="PassUrl" HeaderText="Web Site" ColumnSizer="Auto"/> 通过将 ColumnSizer 属性设置为“自动”,用户将在运行时调整列的大小。 我希望这有帮助!如果您还有任何疑问,请告诉我。
我正在使用xamarin表单的synfusion pdf插件创建pdf,如果我打印我的pdf会发生什么,那么页面上有很多剩余空间,那么我如何才能获得pdf页面的剩余空间...
我目前正在 Flutter 中开发 SfCalendar,我想更改资源的高度以使其在板上显示完整信息。就像我的屏幕截图中的资源“N/A&qu...
我正在使用 SFCalendar 我有一个包含约会的日历,我希望在 onTap 上仅选择约会,而不能选择单元格。 我做过类似的事情: SF日历( //...
如何在 Flutter 的 Syncfusion 图表中将印度语言环境中的 T(千)转换为(K)以获得紧凑货币
我正在使用同步融合图表,我需要以紧凑格式显示 Y 轴。默认情况下,Syncfusion 在 intl 的 NumberFormat 中提供一个参数以允许格式化。但是紧凑的数字符号...
MAUI sfScheduler - 将 API 数据传入 Scheduler
我有一个 .Net MAUI 应用程序(目标平台以及 iOS 和 Win),我第一次尝试使用 SyncFusion Scheduler。 如果我对数据进行硬编码以从 ViewModel 返回,我就可以正常工作了...
Synfusion 饼图仅显示 y 值。如何添加 x 值作为标签?
我目前正在开发一个 C# 控制台应用程序,该应用程序使用 Syncfusion 库 (v20.4.0.53) 创建各种图表并将其保存为图像。 到目前为止,一切都很顺利,我快完成了。
net core C# 同步融合调度程序。 我使调度程序的对话框可拖动 函数 OnPopupOpen(args) { var DragElement = document.getElementById('schedule_dialog_wrapper'); ...
ASP.NET Core 中导出到 Excel Syncfusion 网格时如何放置没有数据的列标题
我想放置没有数据的列标题。 如果我有这样的网格,我想打印没有项目代码的数据: 像这样的Excel:
我有一个带有单选按钮的简单的 Angular Reactive 表单。当我使用 formControl 更改选定的单选按钮值时,更改事件不会触发。还有其他事件会触发...
Maui 如何在 SfComboBox DataTemplate 中设置列表项?
我在 ViewModel 有一个列表 [可观察属性] 私有 IEnumerable _months; 以及班级月份: 公开课月 { 公共字符串名称{获取;在里面; } 公共 int Va...
SyncFusion Scheduler - 难以获取预约详细信息
我有一个.Net MAUI应用程序(目标平台And,iOS&Win) 我第一次尝试使用 SyncFusion Scheduler.. 我一切正常,但我很难获取预约详细信息...
Flutter-SfCalendar - 需要 x 位置的资源和 Y 位置的时间
我在 flutter 的移动应用程序中使用 sfcalendar 来显示约会。它在 Y 位置显示员工(资源),在 X 位置显示时间(工作时间)。 根据客户要求...
我在 ViewModel 中获得了一个列表,并且 UI 对属性值的更改没有反应。 这是关于按钮(SfChip)背景颜色的,未更新。 (选定的按钮为红色,所有其他按钮...
如何给SfChipGroup的ChipBackground绑定属性?
我使用 SfChipGroup 并将 ViewModel 中的 PageButtonList 绑定为 ItemSource。 私有 ObservableCollection _pageButtonList = new ObservableCollection(); 公开