Open mlyrstad opened 1 year ago
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
@mlyrstad if that is what you need you could specify a DataTemplate
like this:
var dataTemplate = new DataTemplate(() => {
var contentView = new ContentView();
contentView.SetBinding(ContentView.ContentProperty, ".");
return contentView;
});
@mlyrstad if that is what you need you could specify a
DataTemplate
like this:var dataTemplate = new DataTemplate(() => { var contentView = new ContentView(); contentView.SetBinding(ContentView.ContentProperty, "."); return contentView; });
I know how to work around it, that's not the point 😄
I think this is more of a solution rather than a workaround.
The BindableLayout
documentation states very clearly that the ItemSource
will be used as BindingContext
.
Now imagine if they change the behavior to support what you're asking: you'll found yourself with a view having itself as BindingContext
potentially overriding the one you already put there.
So in that situation you would also ask to not apply the item source as binding context, completely going against the behavior documented and provided by this tool. And what if someone's desire is to inherit the parent's binding context?
IMHO is not a bug, it's more of a feature request, for which I would eventually create a brand new tool named ObservableChildren
or DynamicChildren
or DynamicLayout
because it would have nothing to do with the concept of Binding
.
No, because why would they set the binding context to itself. That doesn't make any sense at all. Inheriting the parent's binding context is exactly what I would expect in this situation.
Having to add another view inbetween, adding to performance- and memory pressure, when it is simply not necessary, is not a good solution. This is mobile development, these things matter. A lot.
And the best thing is... if this gets implemented, it would change nothing for you and people like you, while I and others like me would be able to optimize the way we wish.
I'm not gonna argue with you. To me, this is an obvious thing. We're just gonna have to agree to disagree. You're absolutely entitled to an opinion, but so am I.
Description
When you use BindableLayout.ItemsSource on a source that contains views, and there's no item template applied, CreateItemView should
(BindableLayout.cs, l358)
and CreateEmptyView should
(BindableLayout.cs, l381)
Public API Changes
None necessary.
Intended Use-Case
I often use BindableLayout for custom components, where each item has already been made into a view for various reasons. In these components I cannot use BindableLayout, because it insists on wrapping these views in a Label. The consequence of this is that I have had to make my own bindablelayout-equivalent.