URL单元中的未定义协议 [英] Undefined protocol in the URL cell

查看:120
本文介绍了URL单元中的未定义协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个样式等于Infragistics.Win.UltraWinGrid.ColumnStyle.URL的UltraGridCell,并将我自己的处理程序添加到UltraGrid.MouseClick中,以便在单击URL列时可以打开一个新选项卡

I have a UltraGridCell with style equal to Infragistics.Win.UltraWinGrid.ColumnStyle.URL and add my own handler to UltraGrid.MouseClick so that I can open a new tab if the URL columns is clicked

如果URL列的值为"ABCDE",则没有任何问题.它看起来像单元格中的URL链接,带有下划线和蓝色(单击后变为紫色).就像浏览器中的URL链接一样.

Nothing is wrong if the URL column is of the value "ABCDE". It looks like a URL link in the cell with underline and blue color (turns purple after click). It just like a URL link in the browser.

问题在于,如果内容的值类似于"ABC:DE".事实证明,它抱怨正在调用一个未定义的协议.就像您在IE URL栏中输入"ABC://DE"一样.

The issue is that if the content is of the value like "ABC:DE". It turns out it complains that there is an undefined protocol is calling. Just like you enter "ABC://DE" at the IE URL bar.

在调试模式下检查后,看来应该由UltraGrid在内部调用它. 因此,我的问题是:我有什么办法可以禁用此默认行为?

After checking in the debug mode, it looks like that this should be called by UltraGrid internally. Hence, my question is: Is there any way for me to disable this default behaviour?

我们非常感谢您的帮助.

Any help is highly appreciated.

推荐答案

将列样式设置为Infragistics.Win.UltraWinGrid.ColumnStyle.URL时,列的编辑器将变为Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor.该编辑器具有LinkClicked事件.在事件处理程序中,您可以获取事件参数的OpenLink属性并将其设置为false.这将抑制链接打开.为此,请首先在InitializeLayout事件中获得编辑器:

When you set the column style to Infragistics.Win.UltraWinGrid.ColumnStyle.URL the editor of the column becomes Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor. This editor has LinkClicked event. In the event handler you can get OpenLink property of the event argument and set it to false. This will suppress link opening. To do so, first get the editor in the InitializeLayout event:

private void UltraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
    // get the column you will set up
    var column = e.Layout.Bands[YOUR_BAND_INDEX].Columns[YOUR_COLUMN_INDEX];

    // set the style of the column (you already did this)
    column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.URL;

    // get the editor after set the column style and handle LinkClicked event
    var editor = column.Editor as FormattedLinkEditor;
    editor.LinkClicked += this.Editor_LinkClicked;
}

然后在LinkClicked事件中停止打开链接:

Then in LinkClicked event stop link opening:

private void Editor_LinkClicked(object sender, Infragistics.Win.FormattedLinkLabel.LinkClickedEventArgs e)
{
    e.OpenLink = false;
}

这篇关于URL单元中的未定义协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆