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

ListView Invalid with ElementNameSubject binding #598

Closed
HaoLife opened this issue Feb 14, 2019 · 4 comments
Closed

ListView Invalid with ElementNameSubject binding #598

HaoLife opened this issue Feb 14, 2019 · 4 comments
Labels
kind/bug Something isn't working platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform

Comments

@HaoLife
Copy link

HaoLife commented Feb 14, 2019

<Page
    x:Class="UnoControlsSample.Shared.Controls.CommandBarPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:UnoControlsSample.Shared.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ios="http://uno.ui/ios"
    xmlns:android="http://uno.ui/android"
    xmlns:xamarin="http://uno.ui/xamarin"
    mc:Ignorable="d ios android xamarin"
    x:Name="CurrentPage"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <ListView Grid.Row="1" x:Name="recipes"  ItemsSource="{x:Bind Users}" Padding="5" Margin="0,20,0,0" 
                HorizontalContentAlignment="Stretch" 
                SelectionMode="None"
                IsItemClickEnabled="True" 
                >
        <ListView.ItemContainerStyle>
            <Style TargetType="ListViewItem">
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="Padding" Value="0" />
                <Setter Property="Margin" Value="0" />
            </Style>
        </ListView.ItemContainerStyle>
        <ListView.ItemTemplate>
            <DataTemplate>
                <Button  Margin="0,5" Content="test command"  Command="{Binding DataContext.TestCommand,ElementName=CurrentPage}"/>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</Page>

I'm submitting a...

Using {Binding DataContext.TestCommand,ElementName=CurrentPage} in ListView is not recognized and can take effect in Android and UWP

Current behavior

Expected behavior

Minimal reproduction of the problem with instructions

Environment

Nuget Package: 

Package Version(s): 

Affected platform(s):
- [x] iOS
- [ ] Android
- [ ] WebAssembly
- [ ] Windows
- [ ] Build tasks

Visual Studio
- [x] 2017 (version: )
- [ ] 2017 Preview (version: )
- [ ] for Mac (version: )

Relevant plugins
- [ ] Resharper (version: )
@jeromelaban jeromelaban added the kind/bug Something isn't working label Mar 6, 2019
@HaoLife
Copy link
Author

HaoLife commented Apr 10, 2019

@jeromelaban External members are bound in ListView, and member bindings outside ListView cannot be used in IOS as long as they are in ListView. Can we follow up on this issue?

Example

        <TextBlock x:Name="title" Text="testing" />

        <ListView ItemsSource="{Binding Tests}" >
            <ListView.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <TextBlock Text="{Binding Text,ElementName=title}" />
                    </StackPanel>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

@HaoLife
Copy link
Author

HaoLife commented Apr 13, 2019

NameScope.FindInNamescopes

ListViewItem can't find the upper object after reloading parent.GetParent (), but can't find the bound object after reloading.

@HaoLife
Copy link
Author

HaoLife commented Apr 13, 2019

@jeromelaban The reason is that the Parent object is not a DependencyObject object, and the object first loaded is Windows.UI.Xaml.Controls.BlockLayout and then loaded again into the UIKit.UIView object.

@ghuntley ghuntley added the platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform label May 22, 2019
@davidjohnoliver
Copy link
Contributor

fixed by #1064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform
Projects
None yet
Development

No branches or pull requests

4 participants