交互式地图 - Scatterview项目和按钮XAML格式 [英] Interactive Map - Scatterview Items and Button XAML Formatting

查看:64
本文介绍了交互式地图 - Scatterview项目和按钮XAML格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试制作我校园的互动地图,我遇到了Buttons和Scatterview项目格式的问题。

I'm trying to make an interactive map of my campus and I'm having an issue with Buttons and Scatterview item formatting.


想法是将按钮设置为地图上的特定区域(当前是背景图像)。按下这些按钮时,会出现一个散点图框,其中包含有关按下按钮的区域的信息。

The idea is to have the buttons set to specific areas on the map (which is currently the background image). These buttons, when pressed, will make a scatterview box appear with information about the area where the button was pressed.


主要问题是按钮是随机的把自己定位在执行上。我试图设定利润和头寸,但无济于事。用户还可以将它们扔到附近,这是不好的。它们需要是静态的。

The main issue is that the buttons are randomly positioning themselves on execution. I've attempted to set margins and positions but to no avail. The user can also fling them around which is no good. They need to be static.


另一个问题是我无法设置scatterview项目的内容。这段代码是与Surface SDK一起分发的SDK示例的再版,名为controlsBox,它有一个非常好的菜单系统,我想最终绑定到最终的程序。但是,
的scatterview项只是空白的灰色框。我想把文字甚至图片放在里面,但Visual studio对我大喊"我已经多次设置了内容"。这可能是由菜单系统引起的。

Another issue is that I can't set the content of scatterview items. This code is a rehash of an SDK example distributed with the Surface SDK called controlsBox, and it has a really nice menu system that I want to eventually tie into the final program. However, the scatterview items are just blank grey boxes. I want to put text and even pictures in them, but Visual studio yells at me that "I've already set the Content more than once". This is presumably due to the menu system.


如果有人可以提供帮助,我们将不胜感激。

If anyone can provide assistance, it would be greatly appreciated.


<s:SurfaceWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008"
    x:Class="ControlsBox.Window1"
    xmlns:local="clr-namespace:ControlsBox"
    xmlns:Resources="clr-namespace:ControlsBox.Resources"     
    Title="ControlsBox">

    <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto"/>
      <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>

    <s:SurfaceListBox Name="ContentSelector" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="43,0,0,0" SelectionChanged="OnSelectionChanged" >


<!-- ElementMenu -->
<s:SurfaceListBoxItem Selected="SurfaceListBoxItem_Selected"  >
<s:SurfaceListBoxItem.Tag>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<Grid.Background >
<ImageBrush ImageSource="campus_map.jpg" Stretch="Uniform"/>
</Grid.Background>


<s:ScatterView HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  >

<s:ScatterView.Resources>
<Image x:Shared="false" x:Key="IconPhoto" Source="Resources\Icons\photo.png"/>
<Image x:Shared="false" x:Key="IconPhotoCopy" Source="Resources\Icons\photo - copy.png"/>
<Image x:Shared="false" x:Key="IconPhotoCrop" Source="Resources\Icons\photo - crop.png"/>
<Image x:Shared="false" x:Key="IconPhotoDelete" Source="Resources\Icons\photo - delete.png"/>
<Image x:Shared="false" x:Key="IconPhotoRedeye" Source="Resources\Icons\photo - redeye correction.png"/>

<Image x:Shared="false" x:Key="IconFile" Source="Resources\Icons\file.png"/>
<Image x:Shared="false" x:Key="IconFileCopy" Source="Resources\Icons\file - copy.png"/>
<Image x:Shared="false" x:Key="IconFileEdit" Source="Resources\Icons\edit.png"/>
<Image x:Shared="false" x:Key="IconFilePrint" Source="Resources\Icons\print.png"/>
<Image x:Shared="false" x:Key="IconFileClose" Source="Resources\Icons\file - close.png"/>

<Image x:Shared="false" x:Key="IconDoc" Source="Resources\Icons\document.png"/>
<Image x:Shared="false" x:Key="IconDocCopy" Source="Resources\Icons\document - copy.png"/>
<Image x:Shared="false" x:Key="IconDocDelete" Source="Resources\Icons\document - delete.png"/>

<Image x:Shared="false" x:Key="IconTools" Source="Resources\Icons\tools.png"/>
<Image x:Shared="false" x:Key="IconToolsSearch" Source="Resources\Icons\search.png"/>
<Image x:Shared="false" x:Key="IconToolsTrash" Source="Resources\Icons\trash.png"/>
<Image x:Shared="false" x:Key="IconToolsUSB" Source="Resources\Icons\usb.png"/>

<Image x:Shared="false" x:Key="IconMail" Source="Resources\Icons\mail.png"/>                
<Image x:Shared="false" x:Key="IconMailCopy" Source="Resources\Icons\mail - copy.png"/>
<Image x:Shared="false" x:Key="IconMailDelete" Source="Resources\Icons\mail - delete.png"/>
<Image x:Shared="false" x:Key="IconMailAttach" Source="Resources\Icons\attach.png"/>
<Image x:Shared="false" x:Key="IconChat" Source="Resources\Icons\chat.png"/>
<Image x:Shared="false" x:Key="IconRefresh" Source="Resources\Icons\refresh.png"/>
</s:ScatterView.Resources>
<!-- ElementMenu always visible. Demonstrates the ActivationMode property.-->

<!--SCATTER VIEW ITEM BOXES FOR THE BUILDING INFORMATION-->
<s:ScatterViewItem

        x:Name="StudentCenter"
        Height="50" 
        Width="50" 
        Orientation="0"
        Background="#FF787878"
        CanMove="False"
        CanRotate="False" MaxWidth="500" MaxHeight="500" Center="9000,9000" Visibility="Visible" >

      <s:ElementMenu                       
            ActivationMode="AlwaysActive"
            HorizontalAlignment="Left" 
            VerticalAlignment="Top">

            <s:ElementMenuItem Header="{x:Static Resources:Resources.Photo}" Icon="{StaticResource IconPhoto}" >
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Copy}" Icon="{StaticResource IconPhotoCopy}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Crop}" Icon="{StaticResource IconPhotoCrop}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Delete}" Icon="{StaticResource IconPhotoDelete}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Redeye_Correction}" Icon="{StaticResource IconPhotoRedeye}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            </s:ElementMenuItem>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.File}"  Icon="{StaticResource IconFile}" >
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Copy}" Icon="{StaticResource IconFileCopy}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Edit}" Icon="{StaticResource IconFileEdit}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Print}" Icon="{StaticResource IconFilePrint}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Close}" Icon="{StaticResource IconFileClose}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            </s:ElementMenuItem>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Document}" Icon="{StaticResource IconDoc}" >
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Copy}" Icon="{StaticResource IconDocCopy}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Delete}" Icon="{StaticResource IconDocDelete}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            </s:ElementMenuItem>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Tools}" Icon="{StaticResource IconTools}" >
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Search}" Icon="{StaticResource IconToolsSearch}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Recycle_Bin}" Icon="{StaticResource IconToolsTrash}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
            <s:ElementMenuItem Header="{x:Static Resources:Resources.Find_Devices}"  Icon="{StaticResource IconToolsUSB}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>                    
            </s:ElementMenuItem>
        </s:ElementMenu>

        </s:ScatterViewItem>
<s:ScatterViewItem

        x:Name="Library"
        Height="50" 
        Width="50" 
        Orientation="0"
        Background="#FF787878"
        CanMove="False"
        CanRotate="False" MaxWidth="500" MaxHeight="500" Center="9000,9000" Visibility="Visible" >
                                <s:ElementMenu 
            ActivationMode="AlwaysActive"
            HorizontalAlignment="Left" 
            VerticalAlignment="Top">
                                    <s:ElementMenuItem Header="{x:Static Resources:Resources.Photo}" Icon="{StaticResource IconPhoto}" >
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Copy}" Icon="{StaticResource IconPhotoCopy}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Crop}" Icon="{StaticResource IconPhotoCrop}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Delete}" Icon="{StaticResource IconPhotoDelete}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Redeye_Correction}" Icon="{StaticResource IconPhotoRedeye}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                    </s:ElementMenuItem>
                                    <s:ElementMenuItem Header="{x:Static Resources:Resources.File}"  Icon="{StaticResource IconFile}" >
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Copy}" Icon="{StaticResource IconFileCopy}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Edit}" Icon="{StaticResource IconFileEdit}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Print}" Icon="{StaticResource IconFilePrint}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Close}" Icon="{StaticResource IconFileClose}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                    </s:ElementMenuItem>
                                    <s:ElementMenuItem Header="{x:Static Resources:Resources.Document}" Icon="{StaticResource IconDoc}" >
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Copy}" Icon="{StaticResource IconDocCopy}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Delete}" Icon="{StaticResource IconDocDelete}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                    </s:ElementMenuItem>
                                    <s:ElementMenuItem Header="{x:Static Resources:Resources.Tools}" Icon="{StaticResource IconTools}" >
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Search}" Icon="{StaticResource IconToolsSearch}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Recycle_Bin}" Icon="{StaticResource IconToolsTrash}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                        <s:ElementMenuItem Header="{x:Static Resources:Resources.Find_Devices}"  Icon="{StaticResource IconToolsUSB}" Command="{x:Static local:Window1.ShowMessageCommand}" CommandParameter="{Binding Path=Header, RelativeSource={x:Static RelativeSource.Self}}"/>
                                    </s:ElementMenuItem>
                                </s:ElementMenu>
                            </s:ScatterViewItem>

<!--BUTTON ITEM BOXES FOR THE USER TO PRESS-->
<Button x:Name="LibraryButton" Canvas.Left="50" Margin="5" Padding="3" 
Content="Button 1" Click="button_click" TouchDown="button_TouchDown"/>
<Button x:Name="StudentCenterButton" Canvas.Left="50" Margin="5" Padding="3" 
Content="Button 1" Click="button_click" TouchDown="button_TouchDown"/>

</s:ScatterView>


 <!--<TextBlock x:Name="textMessage" Width="500" Margin="40" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontFamily="Segoe360" FontSize="17" />-->

                    </Grid>

                </s:SurfaceListBoxItem.Tag>
        ElementMenu
      </s:SurfaceListBoxItem>
      </s:SurfaceListBox>

    <Grid   Grid.Column="1" Background="Transparent" Name="ContentArea" Margin="7"/>

    </Grid>
</s:SurfaceWindow>






推荐答案

Hi Omega_Nemesis28,

Hi Omega_Nemesis28,

From您的描述,我想将此帖移至 
最相关的论坛。还有更多  这方面的专家,所以你会得到 
更好的支持和  可能会有更多运气获得答案。

From your description, I ‘d like to move this post to  the most related forum.There are more  experts in this aspect, so you will get  better support and  may have more luck getting answers.

感谢您的理解。

问候,


这篇关于交互式地图 - Scatterview项目和按钮XAML格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆