Updated name, Fixed type conversion
This commit is contained in:
parent
cb589569a1
commit
d8e18e813d
3 changed files with 4 additions and 4 deletions
|
@ -72,7 +72,6 @@
|
|||
<!-- History -->
|
||||
<Grid Grid.Row="0">
|
||||
<ListBox x:Name="HistoryList" ItemsSource="{Binding History}" SelectedIndex="{Binding SelectedHistoryIndex}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
AutomationProperties.Name="History list">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="m:HistoryItem">
|
||||
|
|
|
@ -6,6 +6,7 @@ using Avalonia.Interactivity;
|
|||
using Avalonia.VisualTree;
|
||||
using AdvancedCalculator.ViewModels;
|
||||
using AdvancedCalculator.Models;
|
||||
using Avalonia.Controls.Presenters;
|
||||
|
||||
namespace AdvancedCalculator.Views;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public partial class MainView : UserControl
|
|||
private void OnHistoryTapped(object? sender, TappedEventArgs e)
|
||||
{
|
||||
// Find the ListBoxItem the tap originated from
|
||||
var source = e.Source as IVisual;
|
||||
var source = e.Source as ContentPresenter;
|
||||
var container = source?.FindAncestorOfType<ListBoxItem>();
|
||||
if (container?.DataContext is not HistoryItem item)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue