0

我正在使用 uwp 社区工具包扩展器,并且在将多个值绑定到标题文本时遇到问题。这甚至可能吗?

 <ListView x:Name="LV"  ItemsSource="{Binding VaccSingelton.VaccOverblikListe}"    ScrollViewer.VerticalScrollBarVisibility="Visible" SelectionChanged="LV_SelectionChanged" >

                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <controls:Expander x:Name="Expander1"  Margin="0,0,0,10" 
                                              Header="{Binding Name}" IsExpanded="false"  >

                                <Grid Margin="0,10,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition></ColumnDefinition>
                                        <ColumnDefinition></ColumnDefinition>
                                    </Grid.ColumnDefinitions>

                                    <Grid.RowDefinitions>
                                        <RowDefinition></RowDefinition>
                                        <RowDefinition></RowDefinition>
                                        <RowDefinition></RowDefinition>
                                        <RowDefinition></RowDefinition>
                                        <RowDefinition></RowDefinition>
                                    </Grid.RowDefinitions>

                                    <TextBlock FontWeight="Bold" Text="Antal Stik:" Grid.Column="0"></TextBlock>
                                    <TextBlock Text="{Binding Stik}" Grid.Column="1" Margin="10,0,0,0">

                                    </TextBlock>

                                    <TextBlock FontWeight="Bold" Text="Udføres på:" Grid.Column="0" Grid.Row="1"></TextBlock>
                                    <TextBlock Text="{Binding  Udførsel}" Grid.Column="1" Grid.Row="1" Margin="10,0,0,0"></TextBlock>

                                    <TextBlock FontWeight="Bold" Text="Bivirkninger:" Grid.Column="0" Grid.Row="2"></TextBlock>
                                    <TextBlock Text="{Binding  Bivirkninger}" Grid.Column="1" Grid.Row="2" Margin="10,0,0,0"></TextBlock>

                                    <TextBlock FontWeight="Bold" Text="Information:" Grid.Column="0" Grid.Row="3"></TextBlock>
                                    <TextBlock Text="{Binding   Info}" Grid.Column="1" Grid.Row="3" Margin="10,0,0,0"></TextBlock>

                                    <TextBlock FontWeight="Bold" Text="Dato:" Grid.Column="0" Grid.Row="4"></TextBlock>
                                    <TextBlock x:Name="test" Grid.Column="1" Grid.Row="4"  Margin="10,0,0,0">
                                        <Run Text="{Binding OpretVaccDatoText}"></Run>

                                    </TextBlock>

                                </Grid>
                            </controls:Expander>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

为了更清楚起见,我想在以下标题中添加更多绑定:

<controls:Expander x:Name="Expander1" Margin="0,0,0,10" Header="{Binding Name}" IsExpanded="false" >

所以应该看起来像这样:

<controls:Expander x:Name="Expander1" Margin="0,0,0,10" Header="{Binding Name, address, Email}" IsExpanded="false" >

4

1 回答 1

1

理想情况下,我建议您只在视图模型中使用您想要显示的属性(我假设三个属性连接在一起),但您也可以使用已编译的绑定( x:Bind),因为它支持函数。

但是,它要求您应用的最低目标 SDK 版本为 14393 或更高版本!

于 2017-05-03T10:13:26.657 回答