|
|
|
@ -1,6 +1,8 @@ |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using Avalonia.Controls; |
|
|
|
using Avalonia.Controls.Primitives; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.Layout; |
|
|
|
using Avalonia.Markup.Xaml; |
|
|
|
using ControlCatalog.ViewModels; |
|
|
|
@ -17,6 +19,7 @@ namespace ControlCatalog.Pages |
|
|
|
this.InitializeComponent(); |
|
|
|
_repeater = this.FindControl<ItemsRepeater>("repeater"); |
|
|
|
_scroller = this.FindControl<ScrollViewer>("scroller"); |
|
|
|
_repeater.PointerPressed += RepeaterClick; |
|
|
|
DataContext = new ItemsRepeaterPageViewModel(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -68,5 +71,11 @@ namespace ControlCatalog.Pages |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void RepeaterClick(object sender, PointerPressedEventArgs e) |
|
|
|
{ |
|
|
|
var item = (e.Source as TextBlock)?.DataContext as string; |
|
|
|
((ItemsRepeaterPageViewModel)DataContext).SelectedItem = item; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|