0

我想在 LongListMultiSelector 中显示我的电话联系人。早些时候我使用列表框来显示电话联系人......我的实现就像:xaml

 <ListBox Name="ContactResultsData" ItemsSource="{Binding}"  Height="331" Margin="12,0" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" >
                            <Border BorderThickness="2" HorizontalAlignment="Left" VerticalAlignment="Center" BorderBrush="{StaticResource PhoneAccentBrush}" >
                                <Image Source="{Binding Converter={StaticResource ContactPictureConverter}}" Width="48" Height="48" Stretch="Fill"  />
                            </Border>
                            <TextBlock Name="ContactResults" Text="{Binding Path=DisplayName, Mode=OneWay}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" Margin="18,8,0,0" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

和 C#

private void SearchContacts_Click(object sender, RoutedEventArgs e)
        {
           ContactResultsData.DataContext = null;
            Contacts cons = new Contacts();
            cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);
        }
        void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
        {
            try
            {
                ContactResultsData.DataContext = e.Results;
            }
            catch (System.Exception)
            {
            }
        }

现在,尽管有列表框,我还是想在 LongListMultiSelector 中显示它。

我怎样才能做到这一点?

现在我正在使用视图模型

public partial class ContactsView : PhoneApplicationPage
    {
public ContactsViewModel()
        {
            var cons = new Microsoft.Phone.UserData.Contacts();
            cons.SearchAsync(String.Empty, FilterKind.None, null);
            cons.SearchCompleted += ContactsSearchCompleted;
        }
        private void ContactsSearchCompleted(object sender, ContactsSearchEventArgs e)
        {
            PhoneContacts = new ObservableCollection<Contact>(e.Results.OrderBy(c => c.DisplayName));

        }

        private ObservableCollection<Contact> _phoneContacts;
        public ObservableCollection<Contact> PhoneContacts
        {
            get { return _phoneContacts; }
            set
            {
                _phoneContacts = value;
                RaisePropertyChanged("PhoneContacts");
            }
        }
}

如何将此 viewModel 绑定到 LongListMultiSelector,以便 ObservableCollection 联系人数据可见?就像图..而不是邮件详细信息,我想显示联系方式。 电话联系方式 http://blogs.windows.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-53-84-metablogapi/clip_5F00_image010_5F00_41CD2003.png


为什么加载 Scala 构建文件时会出现编译错误?

Windows 上的 sbt 0.12.4。

首先,我进入项目目录,也就是example- sbt 下的一个 Scala 项目。当我运行时sbt,我收到以下错误:

C:\programs\example>sbt
[info] Loading project definition from C:\programs\example\project\project
[info] Updating {file:/C:/programs/example/project/project/}default-2ad7de...
[info] Resolving org.scala-sbt#sbt;0.12.4 ...
[info] Resolving org.scala-sbt#main;0.12.4 ...
[info] Resolving org.scala-sbt#actions;0.12.4 ...
[info] Resolving org.scala-sbt#classpath;0.12.4 ...
[info] Resolving org.scala-sbt#launcher-interface;0.12.4 ...
[info] Resolving org.scala-lang#scala-library;2.9.2 ...
[info] Resolving org.scala-sbt#interface;0.12.4 ...
[info] Resolving org.scala-sbt#io;0.12.4 ...
[info] Resolving org.scala-sbt#control;0.12.4 ...
[info] Resolving org.scala-lang#scala-compiler;2.9.2 ...
[info] Resolving org.scala-sbt#completion;0.12.4 ...
[info] Resolving org.scala-sbt#collections;0.12.4 ...
[info] Resolving jline#jline;1.0 ...
[info] Resolving org.scala-sbt#api;0.12.4 ...
[info] Resolving org.scala-sbt#compiler-integration;0.12.4 ...
[info] Resolving org.scala-sbt#incremental-compiler;0.12.4 ...
[info] Resolving org.scala-sbt#logging;0.12.4 ...
[info] Resolving org.scala-sbt#process;0.12.4 ...
[info] Resolving org.scala-sbt#compile;0.12.4 ...
[info] Resolving org.scala-sbt#persist;0.12.4 ...
[info] Resolving org.scala-tools.sbinary#sbinary_2.9.0;0.4.0 ...
[info] Resolving org.scala-sbt#classfile;0.12.4 ...
[info] Resolving org.scala-sbt#compiler-ivy-integration;0.12.4 ...
[info] Resolving org.scala-sbt#ivy;0.12.4 ...
[info] Resolving org.apache.ivy#ivy;2.3.0-rc1 ...
[info] Resolving com.jcraft#jsch;0.1.46 ...
[info] Resolving commons-httpclient#commons-httpclient;3.1 ...
[info] Resolving commons-logging#commons-logging;1.0.4 ...
[info] Resolving commons-codec#commons-codec;1.2 ...
[info] Resolving org.scala-sbt#run;0.12.4 ...
[info] Resolving org.scala-sbt#task-system;0.12.4 ...
[info] Resolving org.scala-sbt#tasks;0.12.4 ...
[info] Resolving org.scala-sbt#tracking;0.12.4 ...
[info] Resolving org.scala-sbt#cache;0.12.4 ...
[info] Resolving org.scala-sbt#testing;0.12.4 ...
[info] Resolving org.scala-sbt#test-agent;0.12.4 ...
[info] Resolving org.scala-tools.testing#test-interface;0.5 ...
[info] Resolving org.scala-sbt#command;0.12.4 ...
[info] Resolving org.scala-sbt#compiler-interface;0.12.4 ...
[info] Resolving org.scala-sbt#precompiled-2_8_2;0.12.4 ...
[info] Resolving org.scala-sbt#precompiled-2_9_3;0.12.4 ...
[info] Resolving org.scala-sbt#precompiled-2_10_1;0.12.4 ...
[info] Done updating.
[info] Loading project definition from C:\programs\example\project
[info] Updating {file:/C:/programs/example/project/}default-116b7c...
[info] Resolving net.databinder#dispatch-http_2.9.2;0.8.8 ...
[info] Resolving net.databinder#dispatch-core_2.9.2;0.8.8 ...
[info] Resolving org.scala-lang#scala-library;2.9.2 ...
[info] Resolving org.apache.httpcomponents#httpclient;4.1.3 ...
[info] Resolving org.apache.httpcomponents#httpcore;4.1.4 ...
[info] Resolving commons-logging#commons-logging;1.1.1 ...
[info] Resolving commons-codec#commons-codec;1.4 ...
[info] Resolving net.databinder#dispatch-futures_2.9.2;0.8.8 ...
//some mor like the above
[info] Done updating.
[info] Compiling 8 Scala sources to C:\programs\example\project\target\scala-2.9
.2\sbt-0.12\classes...
[error] C:\programs\example\project\ProgFunBuild.scala:190: object Test is not a
 value
[error]     (argTask, currentProject, baseDirectory, handoutFiles, submitProject
Name, target, projectDetailsMap, compile in Test) map { (args, currentProject, b
asedir, filesFinder, submitProject, targetDir, detailsMap, _) =>
[error]
                                        ^
[error] C:\programs\example\project\ProgFunBuild.scala:56: object Test is not a
value
[error]     (unmanagedSourceDirectories in Test) <<= (scalaSource in Test)(Seq(_
)),
[error]                                    ^
[error] C:\programs\example\project\ProgFunBuild.scala:265: object Test is not a
 value
[error]     (unmanagedSources in Test) <<= (unmanagedSources in Test, scalaSourc
e in Test, projectDetailsMap, currentProject, gradingTestPackages) map { (source
s, srcTestScalaDir, detailsMap, projectName, gradingSrcs) =>
[error]                          ^
[error] C:\programs\example\project\ProgFunBuild.scala:265: reassignment to val
[error]     (unmanagedSources in Test) <<= (unmanagedSources in Test, scalaSourc
e in Test, projectDetailsMap, currentProject, gradingTestPackages) map { (source
s, srcTestScalaDir, detailsMap, projectName, gradingSrcs) =>
[error]                                ^
[error] C:\programs\example\project\ProgFunBuild.scala:288: object Test is not a
value
[error]   val setTestPropertiesHook = (test in Test) <<= (test in Test).dependsO
n(setTestProperties)
[error]                                        ^
[error] C:\programs\example\project\ProgFunBuild.scala:288: reassignment to val
[error]   val setTestPropertiesHook = (test in Test) <<= (test in Test).dependsO
n(setTestProperties)
[error]                                              ^
[error] C:\programs\example\project\ProgFunBuild.scala:304: object Test is not a
 value
[error]       compile in Test,
[error]                  ^
[error] C:\programs\example\project\ProgFunBuild.scala:512: object Test is not a
 value
[error]   val readTestCompileLog = (compile in Test) <<= (compile in Test) mapR
handleFailure(compileTestFailed)
[error]                                        ^
[error] C:\programs\example\project\ProgFunBuild.scala:512: reassignment to val
[error]   val readTestCompileLog = (compile in Test) <<= (compile in Test) mapR
handleFailure(compileTestFailed)
[error]                                              ^
[error] C:\programs\example\project\ProgFunBuild.scala:553: object Test is not a
value
[error]     (sourceDirectory in Test) <<= (sourceDirectory in (assignmentProject
, Test))
[error]                         ^
[error] C:\programs\example\project\ProgFunBuild.scala:553: reassignment to val
[error]     (sourceDirectory in Test) <<= (sourceDirectory in (assignmentProject
, Test))
[error]                               ^
[error] C:\programs\example\project\ProgFunBuild.scala:561: object Test is not a
 value
[error]     (unmanagedSources in Test) <<= (unmanagedSources in Test, scalaSourc
e in (assignmentProject, Test), gradingTestPackages in assignmentProject, gradeP
rojectDetails) map { (sources, testSrcScalaDir, gradingSrcs, project) =>
[error]                          ^
[error] C:\programs\example\project\ProgFunBuild.scala:561: reassignment to val
[error]     (unmanagedSources in Test) <<= (unmanagedSources in Test, scalaSourc
e in (assignmentProject, Test), gradingTestPackages in assignmentProject, gradeP
rojectDetails) map { (sources, testSrcScalaDir, gradingSrcs, project) =>
[error]                                ^
[error] C:\programs\example\project\ProgFunBuild.scala:570: object Test is not a
 value
[error]      compile in Test,
[error]                 ^
[error] 14 errors found
[error] (compile:compile) Compilation failed
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

更新 当我l在命令提示符下按时,错误日志如下:

[info] Loading project definition from C:\A\example\project\project
[debug] Running task... Cancelable: false, check cycles: false
[debug]
[debug] Initial source changes:
[debug]         removed:Set()
[debug]         added: Set()
[debug]         modified: Set()
[debug] Removed products: Set()
[debug] Modified external sources: Set()
[debug] Modified binary dependencies: Set()
[debug] Initial directly invalidated sources: Set()
[debug]
[debug] Sources indirectly invalidated by:
[debug]         product: Set()
[debug]         binary dep: Set()
[debug]         external source: Set()
[debug] All initially invalidated sources: Set()
[debug] Copy resource mappings:
[debug]
[info] Loading project definition from C:\A\example\project
[debug] Running task... Cancelable: false, check cycles: false
[debug]
[debug] Initial source changes:
[debug]         removed:Set()
[debug]         added: Set(C:\A\example\project\Settings.scala, C:\A\example\pro
ject\StyleChecker.scala, C:\A\example\project\GradingFeedback.scala, C:\A\exampl
e\project\CourseraHttp.scala, C:\A\example\project\ProgFunBuild.scala, C:\A\exam
ple\project\ScalaTestRunner.scala, C:\A\example\project\RichJsValue.scala, C:\A\
example\project\RecordingLogger.scala)
[debug]         modified: Set()
[debug] Removed products: Set()
[debug] Modified external sources: Set()
[debug] Modified binary dependencies: Set()
[debug] Initial directly invalidated sources: Set(C:\A\example\project\Settings.
scala, C:\A\example\project\StyleChecker.scala, C:\A\example\project\GradingFeed
back.scala, C:\A\example\project\CourseraHttp.scala, C:\A\example\project\ProgFu
nBuild.scala, C:\A\example\project\ScalaTestRunner.scala, C:\A\example\project\R
ichJsValue.scala, C:\A\example\project\RecordingLogger.scala)
[debug]
[debug] Sources indirectly invalidated by:
[debug]         product: Set()
[debug]         binary dep: Set()
[debug]         external source: Set()
[debug] All initially invalidated sources: Set(C:\A\example\project\Settings.sca
la, C:\A\example\project\StyleChecker.scala, C:\A\example\project\GradingFeedbac
k.scala, C:\A\example\project\CourseraHttp.scala, C:\A\example\project\ProgFunBu
ild.scala, C:\A\example\project\ScalaTestRunner.scala, C:\A\example\project\Rich
JsValue.scala, C:\A\example\project\RecordingLogger.scala)
[debug] Recompiling all 8 sources: invalidated sources (8) exceeded 50.0% of all
 sources
[info] Compiling 8 Scala sources to C:\A\example\project\target\scala-2.9.2\sbt-
0.12\classes...
[debug] Getting compiler-interface from component compiler for Scala 2.9.2
[debug] Getting compiler-interface from component compiler for Scala 2.9.2
[debug] Running cached compiler b206e9, interfacing (CompilerInterface) with Sca
la compiler version 2.9.2
[debug] Calling Scala compiler with arguments  (CompilerInterface):
[debug]         -deprecation
[debug]         -d
[debug]         C:\A\example\project\target\scala-2.9.2\sbt-0.12\classes
[debug]         -bootclasspath
[debug]         C:\Program Files\Java\jre6\lib\resources.jar;C:\Program Files\Ja
va\jre6\lib\rt.jar;C:\Program Files\Java\jre6\lib\sunrsasign.jar;C:\Program File
s\Java\jre6\lib\jsse.jar;C:\Program Files\Java\jre6\lib\jce.jar;C:\Program Files
\Java\jre6\lib\charsets.jar;C:\Program Files\Java\jre6\lib\modules\jdk.boot.jar;
C:\Program Files\Java\jre6\classes;C:\Documents and Settings\User\.sbt\boot\scal
a-2.9.2\lib\scala-library.jar
[debug]         -classpath
[debug]         C:\A\example\project\target\scala-2.9.2\sbt-0.12\classes;C:\Docu
ments and Settings\User\.ivy2\cache\net.databinder\dispatch-http_2.9.2\jars\disp
atch-http_2.9.2-0.8.8.jar;C:\Documents and Settings\User\.ivy2\cache\net.databin
der\dispatch-core_2.9.2\jars\dispatch-core_2.9.2-0.8.8.jar;C:\Documents and Sett
ings\User\.ivy2\cache\org.apache.httpcomponents\httpclient\jars\httpclient-4.1.3
.jar;C:\Documents and Settings\User\.ivy2\cache\org.apache.httpcomponents\httpco
re\jars\httpcore-4.1.4.jar;C:\Documents and Settings\User\.ivy2\cache\commons-lo
gging\commons-logging\jars\commons-logging-1.1.1.jar;C:\Documents and Settings\U
ser\.ivy2\cache\commons-codec\commons-codec\jars\commons-codec-1.4.jar;C:\Docume
nts and Settings\User\.ivy2\cache\net.databinder\dispatch-futures_2.9.2\jars\dis
patch-futures_2.9.2-0.8.8.jar;C:\Documents and Settings\User\.ivy2\cache\org.sca
lastyle\scalastyle_2.9.1\jars\scalastyle_2.9.1-0.1.3-SNAPSHOT.jar;C:\Documents a
nd Settings\User\.ivy2\cache\org.scalariform\scalariform_2.9.1\jars\scalariform_
2.9.1-0.1.1.jar;C:\Documents and Settings\User\.ivy2\cache\com.github.scopt\scop
t_2.9.1\jars\scopt_2.9.1-2.0.0.jar;C:\Documents and Settings\User\.ivy2\cache\cc
.spray\spray-json_2.9.2\jars\spray-json_2.9.2-1.1.1.jar;C:\Documents and Setting
s\User\.ivy2\cache\org.parboiled\parboiled-scala\jars\parboiled-scala-1.0.2.jar;
C:\Documents and Settings\User\.ivy2\cache\org.parboiled\parboiled-core\jars\par
boiled-core-1.0.2.jar;C:\Documents and Settings\User\.ivy2\cache\org.scalatest\s
calatest_2.9.2\jars\scalatest_2.9.2-1.9.1.jar;C:\Documents and Settings\User\.iv
y2\cache\org.apache.commons\commons-lang3\jars\commons-lang3-3.1.jar;C:\Document
s and Settings\User\.ivy2\cache\scala_2.9.2\sbt_0.12\com.typesafe.sbteclipse\sbt
eclipse-plugin\jars\sbteclipse-plugin-2.1.0.jar;C:\Documents and Settings\User\.
ivy2\cache\scala_2.9.2\sbt_0.12\com.typesafe.sbteclipse\sbteclipse-core\jars\sbt
eclipse-core-2.1.0.jar;C:\Documents and Settings\User\.ivy2\cache\org.scalaz\sca
laz-core_2.9.2\jars\scalaz-core_2.9.2-6.0.4.jar;C:\Documents and Settings\User\.
ivy2\cache\org.scala-sbt\sbt\jars\sbt-0.12.4.jar;C:\Documents and Settings\User\
.ivy2\cache\org.scala-sbt\main\jars\main-0.12.4.jar;C:\Documents and Settings\Us
er\.ivy2\cache\org.scala-sbt\actions\jars\actions-0.12.4.jar;C:\Documents and Se
ttings\User\.ivy2\cache\org.scala-sbt\classpath\jars\classpath-0.12.4.jar;C:\Doc
uments and Settings\User\.ivy2\cache\org.scala-sbt\launcher-interface\jars\launc
her-interface-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala-sb
t\interface\jars\interface-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache
\org.scala-sbt\io\jars\io-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\
org.scala-sbt\control\jars\control-0.12.4.jar;C:\Documents and Settings\User\.sb
t\boot\scala-2.9.2\lib\scala-compiler.jar;C:\Documents and Settings\User\.ivy2\c
ache\org.scala-sbt\completion\jars\completion-0.12.4.jar;C:\Documents and Settin
gs\User\.ivy2\cache\org.scala-sbt\collections\jars\collections-0.12.4.jar;C:\Doc
uments and Settings\User\.ivy2\cache\jline\jline\jars\jline-1.0.jar;C:\Documents
 and Settings\User\.ivy2\cache\org.scala-sbt\api\jars\api-0.12.4.jar;C:\Document
s and Settings\User\.ivy2\cache\org.scala-sbt\compiler-integration\jars\compiler
-integration-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala-sbt
\incremental-compiler\jars\incremental-compiler-0.12.4.jar;C:\Documents and Sett
ings\User\.ivy2\cache\org.scala-sbt\logging\jars\logging-0.12.4.jar;C:\Documents
 and Settings\User\.ivy2\cache\org.scala-sbt\process\jars\process-0.12.4.jar;C:\
Documents and Settings\User\.ivy2\cache\org.scala-sbt\compile\jars\compile-0.12.
4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala-sbt\persist\jars\pers
ist-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala-tools.sbinar
y\sbinary_2.9.0\jars\sbinary_2.9.0-0.4.0.jar;C:\Documents and Settings\User\.ivy
2\cache\org.scala-sbt\classfile\jars\classfile-0.12.4.jar;C:\Documents and Setti
ngs\User\.ivy2\cache\org.scala-sbt\compiler-ivy-integration\jars\compiler-ivy-in
tegration-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala-sbt\iv
y\jars\ivy-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.apache.ivy\
ivy\jars\ivy-2.3.0-rc1.jar;C:\Documents and Settings\User\.ivy2\cache\com.jcraft
\jsch\jars\jsch-0.1.46.jar;C:\Documents and Settings\User\.ivy2\cache\commons-ht
tpclient\commons-httpclient\jars\commons-httpclient-3.1.jar;C:\Documents and Set
tings\User\.ivy2\cache\org.scala-sbt\run\jars\run-0.12.4.jar;C:\Documents and Se
ttings\User\.ivy2\cache\org.scala-sbt\task-system\jars\task-system-0.12.4.jar;C:
\Documents and Settings\User\.ivy2\cache\org.scala-sbt\tasks\jars\tasks-0.12.4.j
ar;C:\Documents and Settings\User\.ivy2\cache\org.scala-sbt\tracking\jars\tracki
ng-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala-sbt\cache\jar
s\cache-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala-sbt\test
ing\jars\testing-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala
-sbt\test-agent\jars\test-agent-0.12.4.jar;C:\Documents and Settings\User\.ivy2\
cache\org.scala-tools.testing\test-interface\jars\test-interface-0.5.jar;C:\Docu
ments and Settings\User\.ivy2\cache\org.scala-sbt\command\jars\command-0.12.4.ja
r;C:\Documents and Settings\User\.ivy2\cache\org.scala-sbt\compiler-interface\ja
rs\compiler-interface-bin-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\
org.scala-sbt\compiler-interface\jars\compiler-interface-src-0.12.4.jar;C:\Docum
ents and Settings\User\.ivy2\cache\org.scala-sbt\precompiled-2_8_2\jars\compiler
-interface-bin-0.12.4.jar;C:\Documents and Settings\User\.ivy2\cache\org.scala-s
bt\precompiled-2_9_3\jars\compiler-interface-bin-0.12.4.jar;C:\Documents and Set
tings\User\.ivy2\cache\org.scala-sbt\precompiled-2_10_1\jars\compiler-interface-
bin-0.12.4.jar
4

2 回答 2

0

我修改了我的视图模型如下:

public class ContactsViewModel : ViewModelBase
{

    public ContactsViewModel()
    {
        Contacts cons = new Contacts();
        cons.SearchAsync(String.Empty, FilterKind.None, null);
        cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);

    }

    void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
    {

        try
        {

            PhoneContactsList = new List<Contact>(e.Results.OrderBy(c => c.DisplayName));
            System.Diagnostics.Debug.WriteLine("PhoneContacts phone" + PhoneContactsList);

        }
        catch (System.Exception)
        {
            //That's okay, no results
        }

    }

    //--------------------------------
    private List<Contact> _phoneContactsList;
    public List<Contact> PhoneContactsList
    {
        get { return _phoneContactsList; }
        set
        {
            _phoneContactsList = value;
            RaisePropertyChanged("PhoneContactsList");
        }
    }
}

而不是 observablecollection ,我使用的是一个列表。在 xaml 中,我将 PhoneContactsList 绑定到我的 longlistmultiselector 如下:

<toolkit:LongListMultiSelector x:Name="contactList" 
                                                Margin="0,14,-12,0"
                                                ItemsSource="{Binding PhoneContactsList}"
                                                LayoutMode="List"
                                                ItemTemplate="{StaticResource ContactItemTemplate}"
            />

其中 ContactItemTemplate 如下:

 <DataTemplate x:Key="ContactItemTemplate">
            <StackPanel Margin="0,-14,0,24" >
                <TextBlock Text="{Binding Path=DisplayName, Mode=OneWay}" 
                                       Margin="0,0,0,-4"
                                       FontSize="{StaticResource PhoneFontSizeExtraLarge}" 
                                       FontFamily="{StaticResource PhoneFontFamilySemiLight}"/>

                <ListBox ItemsSource="{Binding Path=PhoneNumbers}" Height="60"  Margin="36,0,0,0">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Text="{Binding Path=Kind, Mode=OneWay}" />
                                <TextBlock Grid.Column="1" Text=":  " />
                                <TextBlock Grid.Column="2" Text="{Binding Path=PhoneNumber, Mode=OneWay}" />
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

            </StackPanel>
        </DataTemplate>
于 2013-10-06T19:35:37.293 回答
0

在大多数情况下,只需将 ListBox 的所有实例替换为 phone:LongListSelector 即可。在许多情况下,不建议在 ListBox 上使用 LongListSelector(因为会发生一些意外功能),但它应该可以正常工作。

<phone:LongListSelector ItemsSource="{Binding DataList}">
    <phone:LongListSelector.ItemTemplate>
        <DataTemplate/>
    </phone:LongListSelector.ItemTemmplate>
</phone:LongListSelector>
于 2013-09-30T01:11:03.527 回答