문제

나는 WPF와 XAML에 새로운 것이지만, 끈적 거리는 몇 시간 후에 나는 여기서 틀린 것을 알아낼 수 없다.나는 presentationui 어셈블리가 참조로 추가되었습니다.

"Type Reference는 'PresentationUistyleresources'라는 공개 유형을 찾을 수 없습니다. 라인 14 위치 44."

'presentationuistyleresources'가있는 첫 번째 줄에서 오류가 발생합니다.

수행하려고하는 것은 기본 DocumentViewer를 사용하고 인쇄 단추를 제거하고 텍스트 상자를 찾습니다.그런 다음 몇 가지 CButtons와 기능을 추가하고 싶습니다.그러나이 오류는 나를 잠시 동안 뒤로 잡고 있습니다.왜 그런지 알고 있니?

<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>
.

¬¸ × Ì : 위에서 MSDN에서 코드를 찾으려고 노력하고 있습니다. 이는 위의 것입니다.

도움이 되었습니까?

해결책

오류 위치에 지정된 XAML에 오류가 있습니다.PresentationUIStyleResources 대신 PresentationUIStyleResoures (문자 별 확인).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top