zoukankan      html  css  js  c++  java
  • WPF-项目调试不常见错误解决

    1、问题:调试加载XAML页面时,提示"System.Windows.Markup.XamlParseException"类型的第一次机会异常在PresentationFramework.dll中发生

           解决:请检查ImageSource属性的路径是否正确(即使编译无错),请尝试将改属性项删除,再次调试

    2、问题:xaml UI界面控件引用样式(Dictionary.xaml中样式本身无问题)出现混乱的问题。即xaml文件自身样式不设置键名(x:Key),则会影响引用资源文件中样式的部分样式,如下端代码

    <!--UI xaml 自身的样式-->
    <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="Dictionary.xaml"></ResourceDictionary>
                </ResourceDictionary.MergedDictionaries>
               <!-- <Style TargetType="TextBlock"> --  这段句会出问题,应使用下句-->
                <Style x:Key="TextBlockStyleDefault" TargetType="TextBlock">
                    <Setter Property="TextWrapping" Value="NoWrap"/>
                    <Setter Property="TextTrimming" Value="None"/>
                    <Setter Property="Margin" Value="10,10,0,0"/>
                    <Setter Property="FontSize" Value="16"/>
                    <Setter Property="Foreground" Value="#ccdffd"/>
                </Style>
            </ResourceDictionary>    
    
    <!--UI xaml  控件引用-->
    <!--此时需要注明 Style 属性值-->
    <TextBlock Text="类型:"  Style="{DynamicResource TextBlockStyleDefault}"/>
    <!--如果不将自身样式命名,则会影响到 "ComboBoxStyleQuery" 中文本的显示问题-->
    <ComboBox x:Name="cmbProviderName" SelectedValuePath="Value" Style="{DynamicResource ComboBoxStyleQuery}" Margin="0,0,0,0"/>
    

      

  • 相关阅读:
    UEFI和GPT
    EFI/UEFI BIOS 入门
    UEFI+GPT模式下的Windows系统中分区结构和默认分区大小及硬盘整数分区研究
    UEFI和Legacy及UEFI+Legacy启动的区别
    UEFI与MBR区别
    UI基础字典转模型
    UI基础九宫格
    UI基础UIView常见属性及方法
    UI基础控件UIButton
    OC中NSFileManager类 和 copy一些用法
  • 原文地址:https://www.cnblogs.com/xbj-hyml/p/9963833.html
Copyright © 2011-2022 走看看