mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 10:22:13 +08:00
fix: CommandPaletteDataTemplates should only used for command palettes
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -13,8 +13,22 @@ namespace SourceGit.Views
|
||||
{
|
||||
public class CommandPaletteDataTemplates : IDataTemplate
|
||||
{
|
||||
public Control Build(object param) => App.CreateViewForViewModel(param);
|
||||
public bool Match(object data) => true;
|
||||
public Control Build(object param)
|
||||
{
|
||||
return App.CreateViewForViewModel(param);
|
||||
}
|
||||
|
||||
public bool Match(object data)
|
||||
{
|
||||
if (data is not IDisposable)
|
||||
return false;
|
||||
|
||||
var name = data.GetType().FullName;
|
||||
if (!name.EndsWith("CommandPalette", StringComparison.Ordinal) || !name.Contains(".ViewModels.", StringComparison.Ordinal))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Launcher : ChromelessWindow
|
||||
|
||||
Reference in New Issue
Block a user