Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MenuFlyout ItemTemplate not Applied #10010

Closed
workgroupengineering opened this issue Jan 18, 2023 · 6 comments · Fixed by #10020
Closed

MenuFlyout ItemTemplate not Applied #10010

workgroupengineering opened this issue Jan 18, 2023 · 6 comments · Fixed by #10020
Labels

Comments

@workgroupengineering
Copy link
Contributor

immagine

To Reproduce
Steps to reproduce the behavior:

  1. Download Attach
  2. Extract
  3. Open
  4. Run
  5. Click on DropDownButton
  6. You Can se error

Expected behavior
ItemTemplate is applied

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows, Mac, Linux (State distribution)]
  • Version: 11.0.0-preview4

Additional context
Add any other context about the problem here.

DropDownButton_Issue.zip

@rabbitism
Copy link
Contributor

Maybe duplicate with mine #9696

@workgroupengineering
Copy link
Contributor Author

Duplicated

@workgroupengineering workgroupengineering closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2023
@workgroupengineering
Copy link
Contributor Author

workgroupengineering commented Jan 19, 2023

After some thorough investigation the problem is similar but not the same of #9696.

@FG-rgb
Copy link

FG-rgb commented Mar 10, 2023

Fix does not work with Avalonia 11.0.0-preview5.
Now it is complete broken and shows no items:
[Binding]Error in binding to 'Avalonia.Controls.MenuFlyout'.'Items': 'Null value in expression '{empty}' at ''.'(MenuFlyout #5560998)

My Window xaml looks like this:

<Button Content="Testen">
    <Button.Flyout>
	    <MenuFlyout Placement="Left" Items="{Binding Path=TestItems,Mode=OneWay}">
		    <MenuFlyout.ItemTemplate>
			    <DataTemplate>
				    <TextBlock Text="{Binding Path=Name,Mode=OneWay}" />
			    </DataTemplate>
		    </MenuFlyout.ItemTemplate>
	    </MenuFlyout>
    </Button.Flyout>
</Button>

And the ViewModel looks like this:

public record class TestItem(string Name, string Info);

public class MainWindowViewModel
{
    public MainWindowViewModel()
    {
        TestItems = new ObservableCollection<TestItem>
        {
            new TestItem("Hallo", "Hallo Welt"),
            new TestItem("Bla", "Hallo Welt"),
            new TestItem("Blubb", "Hallo Welt"),
            new TestItem("Etwas mehr Text", "Hallo Welt"),
            new TestItem("Hallo Ihr da", "Hallo Welt")
        };
    }

    public ObservableCollection<TestItem> TestItems { get; }

With Avalonia 0.10.18 the items are plain shown in UI as ToString()

@timunie
Copy link
Contributor

timunie commented Mar 10, 2023

@FG-rgb please open this as a new issue. Closed issues will not be followed up. Also your issue seems to be different to the one posted above.

@FG-rgb
Copy link

FG-rgb commented Mar 10, 2023

Ok @timunie bug created:
#10626

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants