내 응용 프로그램에 this (excellent) flowchart diagram designer을 사용하고 있지만 UserControl
으로 사용하고 싶습니다. 사용자의 응답 컨트롤에클래스 라이브러리에서 리소스 사전 사용
<Window x:Class="DiagramDesigner.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:DiagramDesigner"
xmlns:c="clr-namespace:DiagramDesigner.Controls"
WindowStartupLocation="CenterScreen"
Title="Diagram Designer"
Height="850" Width="1000">
<Window.Resources>
<ContextMenu x:Key="DesignerCanvasContextMenu">
...
</ContextMenu>
</Window.Resources>
...
</Window>
:
가 UserControl
에 Application
을 변환하려면 나는 응용 프로그램이 가지고있는 유일한 창을 변경했습니다
<UserControl x:Class="DiagramDesigner.DiagramDesignerWPFControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:DiagramDesigner"
xmlns:c="clr-namespace:DiagramDesigner.Controls"
Height="850" Width="1000">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
...
</ResourceDictionary.MergedDictionaries>
<ContextMenu x:Key="DesignerCanvasContextMenu">
...
</ContextMenu>
</ResourceDictionary>
</UserControl.Resources>
...
</UserControl>
내가 App.xaml
의 내용에서 ResourceDicctionary
했다 그것을 컨트롤에 추가했습니다. 그런 다음 컴파일에서 사용할 수 없으므로 App.xaml
파일을 삭제했습니다.
내 문제는입니다 : 내가 다른 프로젝트에서 WPF 양식에 새로운 User Control
것을 추가 할 때 나는 새로운 응용 프로그램, 내가 차트 구성 요소를 추가하고 이동할 수 있지만 때를 실행할 수
I 다음 예외 발생을 조인/링크합니다.
'{SolidBorderBrush}'라는 리소스를 찾을 수 없습니다. 자원 이름은 대소 문자를 구분합니다.
자원 또는 그 위치가 내 User Control
에 무엇이 잘못 되었습니까? 대답을 수락 한 후
에디션 :
부활하신 예외는 또한 '{SolidBorderBrush가}'라는 한 줄을 지적했다. 처음에는 전화 였고 선언이 아니기 때문에 나는이 질문에 그것을 넣지 않았습니다. 이 예외 연결 코드의 조각 :
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ToolbarSelectedBackgroundBrush}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource SolidBorderBrush}" />
</Trigger>
당신은 App.xaml에서 ResourceDictionary를 가져 왔다고 말했지만, 어디에 넣었는지는 말하지 않았습니다. 리소스 사전, 리소스 및 사용 방법에 대한 자세한 내용은 http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/03/creating-and-consuming-resource-dictionaries-in-wpf- and-silverlight.aspx (특히 [리소스가 다른 범위에서 선언 됨] 참조) (http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/03/creating-and-consuming-resource-dictionaries-in -wpf-and-silverlight.aspx # resources)) – JDB
오, 나는 그것을 'UserControl'에 넣었습니다. 붙여 넣은 코드에서 볼 수 있습니다. 더 많은 질문을 드리겠습니다. –
내 나쁜 ... 나는 코드를 자세히 보지 않았다. – JDB