这是我的类,它基本上是封闭耦合到我想概括这个类的类型。
所以我可以和所有的班级一起使用
一件事很常见,调用此方法时会有一个 Name 字段
public class CustomSuggestionProvider : ISuggestionProvider
{
private const int batchSize = 30;
private string _criteria = string.Empty;
private int _skipCount;
private readonly ObservableCollection<LanguageItem> _observableCollection;
private readonly List<LanguageItem> _source;
public CustomSuggestionProvider(ObservableCollection<LanguageItem> observableCollection, List<LanguageItem> source)
{
_observableCollection = observableCollection;
_source = source;
}
public bool HasMoreSuggestions { get; private set; } = true;
public Task<IList<object>> GetSuggestionsAsync(string criteria, CancellationToken cancellationToken)
{
_criteria = criteria;
var newItems = _source.Where(x => x.Name.IndexOf(_criteria, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
if (cancellationToken.IsCancellationRequested)
return null;
HasMoreSuggestions …Run Code Online (Sandbox Code Playgroud) 我想在用户控件内实现网格左键单击。
我的 WPF 用户控件
<Grid>
<Border Grid.Row="0" CornerRadius="7" >
<Border.Background>
<SolidColorBrush Color="#ffffff" Opacity="0.08"></SolidColorBrush>
</Border.Background>
<Grid>
<Image Source="/Assets/Images/Icon/ic-add.png" Width="70" Height="70"/>
</Grid>
</Border>
</Grid>
Run Code Online (Sandbox Code Playgroud)
这是我的窗口
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<usercontrols:CreateNewProfile Width="200" Height="235" Margin="40,40,0,0">
</usercontrols:CreateNewProfile>
</<StackPanel>
</Grid>
Run Code Online (Sandbox Code Playgroud)
有一个名为 CreateNewProfile 的命令
非常直接的问题如何在用户控件的左键单击上绑定命令?