WPF控件模板

<ItemsControl Name="imgList" >
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <dxlc:LayoutControl Orientation="Vertical" MaxWidth="200">
                            <dxlc:LayoutItem Label="{Binding txt1}" FontWeight="Bold"/>
                            <dxlc:LayoutItem Label="{Binding txt2}" FontWeight="Bold"/>
                            <StackPanel Orientation="Horizontal">
                                <Image Name="img" Source="{Binding tpSource}" RenderOptions.BitmapScalingMode="NearestNeighbor" RenderOptions.ClearTypeHint="Enabled" Stretch= "Uniform" Width="100px" Height="100px" >
                                </Image>
                            </StackPanel>
                        </dxlc:LayoutControl>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
图像显示为像素图,不失真:
RenderOptions.BitmapScalingMode="NearestNeighbor" RenderOptions.ClearTypeHint="Enabled"
等比放大:
Stretch= "Uniform"

后台调用
List<listImg> listImg = new List<listImg>();
listImg.Add(new listImg() { txt1 = "", txt2 = "", tpSource = ImageHelper.CommondRgb(data, bmp) });
ImageHelper.CommondRgb(data, bmp)
见图像处理方法
指针法处理图像 - 驼七 - 博客园 (cnblogs.com)






posted @ 2022-08-22 21:28  驼七  阅读(44)  评论(0)    收藏  举报