لا يمكن العثور على نوع عام اسمه بريسنتاتيونيستيلريسورسز

StackOverflow https://stackoverflow.com/questions/3299987

  •  18-09-2020
  •  | 
  •  

سؤال

أنا جديد على وف و زمل ، ولكن بعد بضع ساعات من غوغلينغ لا أستطيع معرفة ما هو الخطأ هنا.لقد تمت إضافة جمعية العرض التقديمي كمرجع.

"لا يمكن لمرجع النوع العثور على نوع عام يسمى "بريسنتيونويستيلريسورسز".خط 14 موقف 44."

يحدث الخطأ في السطر الأول مع 'بريسنتيونيوستيليريسورسز'.

ما أحاول القيام به هو أخذ المستند الافتراضي لهم وإزالة زر الطباعة والعثور على مربع النص.ثم أريد أن أضيف عدد قليل من أكثر كبوتونس ووظائفها.لكن هذا الخطأ كان يعيقني لفترة من الوقت.أحد يعرف لماذا?

<UserControl x:Class="MyNamespace.MyClass"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System_Windows_Documents="clr-namespace:System.Windows.Documents;assembly=PresentationUI" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="353" Width="361" OverridesDefaultStyle="True">

<UserControl.Resources>

    <Style x:Key="DocumentViewerStyle1" BasedOn="{x:Null}" TargetType="{x:Type DocumentViewer}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="ContextMenu" Value="{DynamicResource {ComponentResourceKey ResourceId=PUIDocumentViewerContextMenu, TypeInTargetAssembly={x:Type System_Windows_Documents:PresentationUIStyleResoures}}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DocumentViewer}">
                    <Border Focusable="False" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid Background="{TemplateBinding Background}" KeyboardNavigation.TabNavigation="Local">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <ContentControl Style="{DynamicResource {ComponentResourceKey ResourceId=PUIDocumentViewerToolBarStyleKey, TypeInTargetAssembly={x:Type System_Windows_Documents:PresentationUIStyleResources}}}" TabIndex="0" Focusable="{TemplateBinding Focusable}" Grid.Column="0" Grid.Row="0"/>
                            <ScrollViewer x:Name="PART_ContentHost" IsTabStop="true" TabIndex="1" Focusable="{TemplateBinding Focusable}" Grid.Column="0" Grid.Row="1" CanContentScroll="true" HorizontalScrollBarVisibility="Auto"/>
                            <DockPanel Grid.Row="1">
                                <FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right"/>
                                <Rectangle VerticalAlignment="top" Height="10" Visibility="Visible">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                            <LinearGradientBrush.GradientStops>
                                                <GradientStopCollection>
                                                    <GradientStop Color="#66000000" Offset="0"/>
                                                    <GradientStop Color="Transparent" Offset="1"/>
                                                </GradientStopCollection>
                                            </LinearGradientBrush.GradientStops>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                            </DockPanel>
                            <ContentControl TabIndex="2" Focusable="{TemplateBinding Focusable}" Grid.Column="0" Grid.Row="2"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</UserControl.Resources>
<Grid>
    <DocumentViewer   x:Name="MyDocumentViewer" Style="{DynamicResource DocumentViewerStyle1}"/>
</Grid>

</UserControl>

ملاحظة:لقد حاولت إلى حد كبير العثور على رمز على مسن لهذا ، وهو ما هو أعلاه.

هل كانت مفيدة؟

المحلول

لديك خطأ مطبعي في زمل الخاص بك في المحدد في موقف الخطأ.يجب أن يكون PresentationUIStyleResources بدلا من PresentationUIStyleResoures (تحقق من الأسماء بالحروف).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top