What I need is that when mouse per listviewitem show me all data from each in a tooltip.
This is a part of my viewmdel
...
...
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
...
...
private ObservableCollection<Articulo> _articulos;
private Articulo _articuloSeleccionado;
public ObservableCollection<Articulo> Articulos
{
get { return _articulos; }
set
{
_articulos = value;
RaisePropertyChanged();
}
}
public Articulo ArticuloSeleccionado
{
get { return _articuloSeleccionado; }
set
{
_articuloSeleccionado = value;
RaisePropertyChanged();
}
}
My .xalm
<ListView Name="lvResultado"
ItemsSource="{Binding Articulos}"
SelectedItem="{Binding ArticuloSeleccionado}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridViewColumn Header="Código de barras" Width="200" DisplayMemberBinding="{Binding CodigoDeBarras}"/>
<GridViewColumn Header="Descripción" Width="250" DisplayMemberBinding="{Binding Descripcion}"/>
</GridView>
</ListView.View>
</ListView>
Thank you for your help. I tried several things but no good result.
You can define an ItemContainerStyle
that would set your tooltip template and content.
See an example below, here I define an UniformGrid
to display multiple text lines in one column. You are free to setup your tooltip as you wish. You still need to tell the view which data properties need to be displayed in the tooltip.
<ListView ItemsSource="{Binding Articulos}">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="ToolTip">
<Setter.Value>
<UniformGrid Columns="1">
<TextBlock Text="{Binding CodigoDeBarras}"/>
<TextBlock Text="{Binding Descripcion}"/>
<TextBlock Text="{Binding AnyOtherProperty}"/>
</UniformGrid>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
</ListView>