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

Add ability to bind to attachments property #619

Open
nickl-martin opened this issue Mar 15, 2024 · 1 comment
Open

Add ability to bind to attachments property #619

nickl-martin opened this issue Mar 15, 2024 · 1 comment

Comments

@nickl-martin
Copy link

nickl-martin commented Mar 15, 2024

Unless I'm mistaken, there's currently no way to bind to the attachments property. This would be useful to declare styles for Uranium controls that use attachments.

Currently you have to add the attachment to every instance of the UI control like so:

<mtrl:PickerField
    Title="My Picker"
    ItemsSource="{Binding Items}">
    <mtrl:PickerField.Attachments>
        <Image
	    Margin="0,0,4,0"
	    Source="expand.png"/>
    </mtrl:PickerField.Attachmets>
</mtrl:PickerField>

It would be useful to instead be able to define a style like this:

<Style 
    x:Key="PickerWithAttachment"
    TargetType="mtrl:PickerField">
    <Setter Property="Attachments">
        <Image
            Margin="0,0,4,0"
            Source="expand.png"/>
    </Setter>
</Style>

But when I try this I get the following error:

Cannot resolve property "Attachments" on type "PickerField (property missing or missing accessors)".

@enisn enisn added this to the v2.9 milestone Mar 20, 2024
@enisn enisn removed the good first issue Good for newcomers label Mar 20, 2024
@enisn
Copy link
Owner

enisn commented Mar 20, 2024

It seems it's not possible right now, it's a simple IEnumerable<IView> and the same instance should be used always. It's not a settable field.

public IList<IView> Attachments => endIconsContainer.Children;

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

No branches or pull requests

2 participants