积极答复者
ListBox中图片模糊不堪,烦人啊~

问题
-
神啊,我到底做错了什么,导致图片模糊成这样:
xaml:
<Grid> <ListBox x:Name="lb" SelectedValuePath="Bitmap"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="7" Rows="6"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Viewbox MaxWidth="{Binding Bitmap.Width}" MaxHeight="{Binding Bitmap.Height}"> <Image Source="{Binding Bitmap}"></Image> </Viewbox> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid>
T_T我期待的清晰是这样的:
答案
-
图片模糊一般是受到布局影响。避免在布局中使用非整数数值,可以尝试UseLayoutRounding =“true”让所有非整数像素值舍入为整数像素值。
- 已标记为答案 Behindmoon 2011年9月2日 7:04
全部回复
-
还有,你其实不需要一个viewPort包着,对于图片如果不小心ViewPort进行了细微的缩放,就会不清晰。所以你直接用Image就可以了。
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
图片模糊一般是受到布局影响。避免在布局中使用非整数数值,可以尝试UseLayoutRounding =“true”让所有非整数像素值舍入为整数像素值。
- 已标记为答案 Behindmoon 2011年9月2日 7:04