多个绑定到 header 文本。
Multible bindings to a header text.
我正在使用 uwp 社区工具包扩展器,但在将多个值绑定到 header 文本时遇到问题。这可能吗?
<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>
只是为了更清楚,我想在 header 里面添加更多的绑定:
<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" >
理想情况下,我建议在您的视图模型中使用您想要显示的内容 属性(我假设这三个属性串联),但您也可以使用 compiled bindings(x:Bind
) 因为它支持函数。
但是,它要求您的应用的最低目标 SDK 版本为 14393 或更高版本!
我正在使用 uwp 社区工具包扩展器,但在将多个值绑定到 header 文本时遇到问题。这可能吗?
<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>
只是为了更清楚,我想在 header 里面添加更多的绑定:
<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" >
理想情况下,我建议在您的视图模型中使用您想要显示的内容 属性(我假设这三个属性串联),但您也可以使用 compiled bindings(x:Bind
) 因为它支持函数。
但是,它要求您的应用的最低目标 SDK 版本为 14393 或更高版本!