Skip to content

Instantly share code, notes, and snippets.

@habibg1232191
Last active December 5, 2021 18:37
Show Gist options
  • Save habibg1232191/5e65324ca67a0d71c5e9e29472825200 to your computer and use it in GitHub Desktop.
Save habibg1232191/5e65324ca67a0d71c5e9e29472825200 to your computer and use it in GitHub Desktop.
<controls:MList Items="{Binding Photos}">
<controls:MList.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding urls}"></TextBlock>
</Grid>
</DataTemplate>
</controls:MList.ItemTemplate>
</controls:MList>
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Interactivity;
namespace Switch_Wallparer.Views.Controls
{
public class MList : ListBox
{
public MList()
{
foreach (var item in Items)
{
Console.WriteLine(item);
}
}
}
}
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Switch_Wallparer.Views.Controls">
<Design.PreviewWith>
<controls:MList />
</Design.PreviewWith>
<Style Selector="controls|MList">
<!-- Set Defaults -->
<Setter Property="Template">
<ControlTemplate>
<Grid></Grid>
</ControlTemplate>
</Setter>
</Style>
</Styles>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment