2015-02-05 1 views
0

Surface 2.0 SDK를 사용하는 Windows 멀티 터치 응용 프로그램에서 작업하고 있습니다. 컨트롤을 "복제"해야합니다.이 경우에는 ScatterViewItem이 필요합니다.이 ScatterViewItem에는 Click 이벤트 처리기가있는 "CopyButton"이있는 ElementMenu가 추가되었습니다. 이 내 ScatterViewItem입니다 :서페이스 응용 프로그램에서 ScatterViewItem 컨트롤 복제

<s:ScatterViewItem x:Name="PhotoPadSVI" MinWidth="296" Background="Transparent" Style="{StaticResource ScatterViewItemStyle}">......</ScatterViewItem> 

그리고 이것은 내가 사용하는 코드와 그 작동하지 않습니다

void DocumentDuplicate_Click(object sender, RoutedEventArgs e) 
{ 
    ScatterViewItem swi = PhotoPadSVI; //error is already here cause I set it as the same, but I cannot found a ".Clone()" like method 
    swi.Visibility = System.Windows.Visibility.Visible; 
    swi.ZIndex = 100; 
    swi.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; 

    //sView.Items.Add(swi); cannot add to ScatterView cause swi is equal to PhotoPadSVI 
} 

질문을 : 당신은 어떤 방법으로 나는 ScatterViewItem를 복제 할 수 아십니까 ?

답변

0

인스턴스를 ScatterViewItem으로 구성해야합니다. ContentPhotoPadSVI's과 동일하게 설정하면 작동합니다. PhotoPadSVI'sContent이 경우 ScatterView에 같은 항목을 추가 할 수 없습니다 나타내는 오류가 계속있는 경우

ScatterViewItem swi = new ScatterViewItem() { Content = PhotoPadSVI.Content }; 

, 당신은 코드에서 새 ScatterViewItem'sContent을 생성, 처음부터해야 할이 훨씬 더 복잡 할 수 XAML 코드 묶음.

this blog도 참조하십시오.

관련 문제