我很小心地在论坛中检查了这一点,但我没有找到解决方案。
这很完美:
<Image Margin="0,0,0,0" Stretch="UniformToFill" Source="http://localhost:5313/Images/1.png" MaxHeight="140" MinHeight="155" VerticalAlignment="Top"/>
为什么这不起作用:
<Image Margin="0,0,0,0" Stretch="UniformToFill" Source="{Binding ImagenSeleccionada}" MaxHeight="140" MinHeight="155" VerticalAlignment="Top"/>
后面的代码。
private string _imagenSeleccionada;
public string ImagenSeleccionada
{
get
{
return this._imagenSeleccionada;
}
set
{
if (this._imagenSeleccionada == value)
return;
this._imagenSeleccionada = value;
}
}
主页
控制
ItemsSource="{Binding FilteredTemperatureReports}" UseLayoutRounding="False" RowHeight="20" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionMode="Single" HorizontalGridLinesBrush="Transparent" VerticalGridLinesBrush="Transparent" Background="{x:Null }" BorderBrush="{x:Null}" IsFilteringAllowed="False" RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False" ShowGroupPanel="False" HeaderRowStyle="{StaticResource GridViewHeaderRowStyle}" GroupRowStyle="{StaticResource GridViewGroupRowStyle}" RowStyle="{StaticResource GridViewRowStyle}">
<telerik:GridViewDataColumn Width="150" DataMemberBinding="{Binding Medio}" IsReadOnly="True" Header="Medio"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyleFirst}"
CellStyle="{StaticResource GridViewCellStyle}" />
<telerik:GridViewDataColumn Width="80" DataMemberBinding="{Binding TimeStamp}" IsReadOnly="True" Header="Fecha" DataFormatString="{} {0:dd/MM/yyyy}"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewDataColumn Width="200" DataMemberBinding="{Binding Producto}" IsReadOnly="True" Header="Producto"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewDataColumn Width="180" DataMemberBinding="{Binding Version}" IsReadOnly="True" Header="Version"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewDataColumn Width="80" DataMemberBinding="{Binding Inversion}" IsReadOnly="True" Header="Inversion" DataFormatString="{}{0:C}"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewDataColumn Width="80" DataMemberBinding="{Binding Ytd}" IsReadOnly="True" Header="YTD" DataFormatString="{}{0:C}"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewColumn Width="80" IsReadOnly="True" Header="Product"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}" >
网格背后的代码。
void OnGridViewSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
{
var grid = sender as RadGridView;
if (grid.SelectedItem != null)
{
grid.ScrollIntoView(grid.SelectedItem);
var _internetDataViewModel = this.DataContext as InternetDataViewModel;
_internetDataViewModel.ImagenSeleccionada = ((ExecutiveDashboard.TemperatureData)(grid.SelectedItem)).Image;
}
}
什么不好?
纳克斯