WPF 踩过的坑
1,wpf 项目复制别人的图片或样式文件,生成报错,需要把文件或图片点击属性设置资源文件
2,选项卡设计ui界面时,调整其它面板的控件,设置该属性 IsChecked="True"
            <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center">
                <RadioButton x:Name="BaseBtn" Content="基本信息" GroupName="R_Btn_G" Width="220" Height="64" Margin="10 0" 
                             Style="{StaticResource MenuBtn_Style}"/>
                <RadioButton x:Name="ReportBtn" Content="评估报告" GroupName="R_Btn_G" Width="220" Height="64" Margin="10 0" 
                           IsChecked="True"   Style="{StaticResource MenuBtn_Style}"/>
            </StackPanel>
3,LiveCharts2 官网图片不显示,host需要配置下面ip地址
https://livecharts.dev/docs/wpf/2.0.0-beta.950/gallery
140.82.113.3 github.com
140.82.114.20     gist.github.com
151.101.184.133    assets-cdn.github.com
185.199.108.133    raw.githubusercontent.com
185.199.109.133     raw.githubusercontent.com
185.199.110.133     raw.githubusercontent.com
185.199.111.133     raw.githubusercontent.com
151.101.184.133    gist.githubusercontent.com
151.101.184.133    cloud.githubusercontent.com
151.101.184.133    camo.githubusercontent.com
199.232.96.133     avatars.githubusercontent.com
199.232.68.133     raw.githubusercontent.com
C:\Windows\System32\drivers\etc
方法1:
vs2022 nuget包 安装 Install-Package LiveChartsCore.SkiaSharpView.WPF -Version 2.0.0-beta.701
方法2

4,wpf的UserControl用户控件怎么添加到Window窗体中
两种方法推荐
https://www.cnblogs.com/lelehellow/p/6026766.html
Dispatcher.Invok是WPF中特有的。使用方法如下
参考文献:Dispatcher.Invoke方法 - 宏宇 - 博客园 (cnblogs.com)
 public static MessageResult ShowDialog(string context)
        {
            MessageResult r = null;
            App.Current.Dispatcher.Invoke(() =>
            {
                var mb = new MsgBox();
                mb.Context = context;
                mb.Result += (s, e) =>
                {
                    r = e.Result;
                };
                mb.ShowDialog();
            });
            return r;
        }
6,vs2022 设置编码格式 参考文献:VS2022设置编码方式为utf-8的三种方式_vs设置utf8编码_QQVQQ...的博客-CSDN博客
7,mvvm模式模式开发,文本框输入的新的值,另外的bord元素鼠标点击获取不到文本框新改的值
<Border Height="88" Width="90" Background="{Binding 属性}" Style="{StaticResource BorderCircular}" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<i:InvokeCommandAction Command="{Binding 命令}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<TextBlock Text="{Binding 属性}" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" />
</Border>
view层需要设置text属性UpdateSourceTrigger触发器
<TextBox Grid.Row="1" Grid.Column="1" Width="80" Height="40" HorizontalAlignment="Left" FontSize="20" Text="{Binding 属性,UpdateSourceTrigger=PropertyChanged}" />
                    
                
                
            
        
浙公网安备 33010602011771号