惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
小众软件
小众软件
Last Week in AI
Last Week in AI
月光博客
月光博客
博客园 - 聂微东
Recent Announcements
Recent Announcements
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky
云风的 BLOG
云风的 BLOG
量子位
N
Netflix TechBlog - Medium
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
博客园 - 司徒正美
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享

博客园 - FredGrit

WPF customize via three combied custom controls WPF DataGrid DataGridTemplateColumn DataTemplate ContentPresenter ContentTemplate WPF Customcontrol NumUpDownScroller WPF CustomControl override Template in Generic.xaml and invoke different style WPF HierarchicalDataTemplate customize via ToggleButton WPF DataGrid DataGridTemplateColumn DataTemplate call predefined DataTemplate via ContentPresenter and ContentTemplate WPF ListBox load data via contentcontrol an ItemTemplate WPF DataGrid load data from Asp.Net Core WebAPI WPF TreeView HierarchicalDataTemplate with grouped Data WPF display grouped data with GroupBox and ItemsControl WPF two listbox scroll syncchronously via behavior WPF invoke data from WebAPI,DataGridTemplate call pre defined DataTemplate via ContentPresenter WPF ListBox load data from WCF WPF datagrid load data from WCF via json, export selected items to json file WPF ItemsControl load data from WCF,DataTemplate, ContentControl WPF customize rotated wheel relentlessly via custom control WPF embed DataTemplate in HierchicalDataTemplate of TreeView WPF ContentControl, ItemsControl, ItemsPanelTemplate,VirtualizingStackPanel,convert xml string to List<T> WPF parse web.config recursively, TreeView and HierarchicalDataTemplate WPF Custom control in cs and Generic.xaml WPF ContextMenu independent visual tree resolved via Freezable implemented class WPF custom control GetTemplateChild vs FindName,NameScope separation between Logical Tree and Visual Tree, WPF ListBox ListView Datatemplate, parse xml to List via XmlSerializer and StringReader WPF TreeView HierarchicalDataTemplate, parse xml via traverse in XmlElement WPF parse xml via [XmRoot] and [XmlElement] attributes together, contentcontrol's template is ControlTemplate from Resources WPF ContentControl invoke Template from resource, reuse datatemplate WPF deserialize xml string as List via [XmlRoot] and [XmlElement] attribute WPF ContentControl Template WPF DatagridTemplate Binding DataTemplate WPF TreeView explicitly given key name to HierarchicalDataTemplate
WPF WeakReference
FredGrit · 2026-03-29 · via 博客园 - FredGrit
Install-Package MessagePack
Install-Package Newtonsoft.json
public class ImgUrlToImgSourceConverter : IValueConverter
{
    Dictionary<string, WeakReference<BitmapImage>> imgCache = new Dictionary<string, WeakReference<BitmapImage>>();
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        try
        {
            string? imgUrl = value?.ToString();
            if (!string.IsNullOrEmpty(imgUrl) && File.Exists(imgUrl))
            {
                if (imgCache.TryGetValue(imgUrl, out var weakRef) && weakRef.TryGetTarget(out var cachedImg))
                {
                    return cachedImg;
                }
                BitmapImage bmi = new BitmapImage();
                bmi.BeginInit();
                bmi.UriSource = new Uri(imgUrl, UriKind.RelativeOrAbsolute);
                bmi.CacheOption = BitmapCacheOption.OnDemand;
                bmi.CreateOptions = BitmapCreateOptions.DelayCreation;
                bmi.EndInit();
                if (bmi.CanFreeze)
                {
                    bmi.Freeze();
                }
                imgCache[imgUrl] = new WeakReference<BitmapImage>(bmi);
                return bmi;
            }
            return null;
        }
        catch (Exception ex)
        {
            return null;
        }
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
2026-03-29T22:13:36.6861304+08:00,start:0,end:49999999,batch size:1000000,batch_count:51
'WpfApp9.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.4\System.Numerics.Vectors.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WpfApp9.exe' (CoreCLR: clrhost): Loaded 'D:\C\WpfApp9\WpfApp9\bin\Debug\net10.0-windows\Newtonsoft.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WpfApp9.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.4\System.Runtime.Numerics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WpfApp9.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.4\System.Linq.Expressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WpfApp9.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.4\System.Data.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
2026-03-29 22:13:37,startIdx:0,endIdx:1000000,batch:1
2026-03-29 22:13:38,startIdx:1000000,endIdx:2000000,batch:2
2026-03-29 22:13:39,startIdx:2000000,endIdx:3000000,batch:3
2026-03-29 22:13:40,startIdx:3000000,endIdx:4000000,batch:4
2026-03-29 22:13:43,startIdx:4000000,endIdx:5000000,batch:5
2026-03-29 22:13:44,startIdx:5000000,endIdx:6000000,batch:6
2026-03-29 22:13:44,startIdx:6000000,endIdx:7000000,batch:7
2026-03-29 22:13:45,startIdx:7000000,endIdx:8000000,batch:8
2026-03-29 22:13:46,startIdx:8000000,endIdx:9000000,batch:9
2026-03-29 22:13:49,startIdx:9000000,endIdx:10000000,batch:10
2026-03-29 22:13:50,startIdx:10000000,endIdx:11000000,batch:11
2026-03-29 22:13:51,startIdx:11000000,endIdx:12000000,batch:12
2026-03-29 22:13:52,startIdx:12000000,endIdx:13000000,batch:13
2026-03-29 22:13:52,startIdx:13000000,endIdx:14000000,batch:14
2026-03-29 22:13:54,startIdx:14000000,endIdx:15000000,batch:15
2026-03-29 22:13:56,startIdx:15000000,endIdx:16000000,batch:16
2026-03-29 22:13:58,startIdx:16000000,endIdx:17000000,batch:17
2026-03-29 22:13:59,startIdx:17000000,endIdx:18000000,batch:18
2026-03-29 22:14:00,startIdx:18000000,endIdx:19000000,batch:19
2026-03-29 22:14:00,startIdx:19000000,endIdx:20000000,batch:20
2026-03-29 22:14:02,startIdx:20000000,endIdx:21000000,batch:21
2026-03-29 22:14:05,startIdx:21000000,endIdx:22000000,batch:22
2026-03-29 22:14:06,startIdx:22000000,endIdx:23000000,batch:23
2026-03-29 22:14:07,startIdx:23000000,endIdx:24000000,batch:24
2026-03-29 22:14:08,startIdx:24000000,endIdx:25000000,batch:25
2026-03-29 22:14:09,startIdx:25000000,endIdx:26000000,batch:26
2026-03-29 22:14:10,startIdx:26000000,endIdx:27000000,batch:27
2026-03-29 22:14:12,startIdx:27000000,endIdx:28000000,batch:28
2026-03-29 22:14:15,startIdx:28000000,endIdx:29000000,batch:29
2026-03-29 22:14:16,startIdx:29000000,endIdx:30000000,batch:30
2026-03-29 22:14:17,startIdx:30000000,endIdx:31000000,batch:31
2026-03-29 22:14:17,startIdx:31000000,endIdx:32000000,batch:32
2026-03-29 22:14:18,startIdx:32000000,endIdx:33000000,batch:33
2026-03-29 22:14:19,startIdx:33000000,endIdx:34000000,batch:34
2026-03-29 22:14:21,startIdx:34000000,endIdx:35000000,batch:35
2026-03-29 22:14:25,startIdx:35000000,endIdx:36000000,batch:36
2026-03-29 22:14:26,startIdx:36000000,endIdx:37000000,batch:37
2026-03-29 22:14:27,startIdx:37000000,endIdx:38000000,batch:38
2026-03-29 22:14:28,startIdx:38000000,endIdx:39000000,batch:39
2026-03-29 22:14:29,startIdx:39000000,endIdx:40000000,batch:40
2026-03-29 22:14:30,startIdx:40000000,endIdx:41000000,batch:41
2026-03-29 22:14:31,startIdx:41000000,endIdx:42000000,batch:42
2026-03-29 22:14:32,startIdx:42000000,endIdx:43000000,batch:43
2026-03-29 22:14:35,startIdx:43000000,endIdx:44000000,batch:44
2026-03-29 22:14:38,startIdx:44000000,endIdx:45000000,batch:45
2026-03-29 22:14:39,startIdx:45000000,endIdx:46000000,batch:46
2026-03-29 22:14:40,startIdx:46000000,endIdx:47000000,batch:47
2026-03-29 22:14:41,startIdx:47000000,endIdx:48000000,batch:48
2026-03-29 22:14:42,startIdx:48000000,endIdx:49000000,batch:49
2026-03-29 22:14:43,startIdx:49000000,endIdx:49999999,batch:50
2026-03-29 22:14:43,start:0,end:49999999,jsonFile:Json_202603292213367039.json finished