当我正在使用SL3/SL4应用程序并开始使用字体时,我发现缺少有关字体策略的文档和最佳实践.例如:
任何可以导致至少一些上述问题的链接或指针都将非常感激.
我正在Silverlight 4 Beta中构建原型应用程序,我使用的是Out-of-Browser(OOB)功能.我需要OOB功能才能访问本地文件系统,我想避免编写ActiveX组件或Java小程序.
我需要能够在客户端计算机上安装后从浏览器启动OOB体验.我似乎能够做的就是从浏览器中检测应用程序是否已安装,然后要求用户从桌面或开始菜单(作为普通应用程序)启动它.
然而,这"打破"了客户所需的体验,应该从浏览器引导.有没有人能够直接从浏览器启动OOB应用程序?
谢谢,
马亭
我刚刚开始使用SL4运行VS2010时遇到此Javascript错误
Error: Unhandled Error in Silverlight Application
Code: 2104
Category: InitializeError
Message: Could not download the Silverlight application. Check web server settings
Run Code Online (Sandbox Code Playgroud)
一切都运行正常,更改了1行代码以在Web项目中使用RegularExpression(使用Silverlight业务应用程序模板),然后在重建时出现此错误.
谷歌称这是与IIS和mimetype相关的.我在VS2010上使用的是Cassini而不是IIS.
从IE缓存重新启动,清除xap.IE和FF都出错.
可能有什么不对?
有没有办法为WP7应用程序添加配置文件,例如Windows应用程序和Web应用程序?我只需要一种简单的方法来保存一些设置,我宁愿不创建自己的对象,也必须序列化/反序列化一个xml文件.似乎没有任何类型的项目模板可以添加到我的项目中,所以只是想知道是否有人在最佳方式上做了这个或一个想法?
我正在尝试从ListBox中选择它时更改ListBoxItem上的Control模板.为此,我将从ListBox本身获取选定的ListBoxItem,并在其上设置控件模板.我该怎么做呢?我试过,SelectedItem并返回ListBoxItem中的绑定对象.
我是Silverlight的新手,虽然我一直在关注一些教程,但我想创建一个带有类库的新项目,以便我可以从我的页面的xaml.cs代码中使用它.
但是当我尝试添加我的类库项目时,我收到一条警告消息:
您只能在解决方案中向项目引用添加其他Silverlight项目
它说的很清楚.但这背后的原因是什么?为什么我不能将类库项目引用添加到Silverlight项目?
谢谢
我有一个ListBox,包括一个带有2个StackPanels的ItemTemplate.我想要访问的第二个StackPanel中有一个TextBox.(将其可见性更改为true并接受用户输入)触发器应为SelectionChangedEvent.因此,如果用户单击ListBoxItem,TextBlock将变为不可见,TextBox将变为可见.
XAML代码:
<ListBox Grid.Row="1" Name="ContactListBox" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ItemsSource="{Binding Contacts}" Margin="0,36,0,0" SelectionChanged="ContactListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,0">
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="Edit Contact" Click="ContactMenuItem_Click"/>
<toolkit:MenuItem Header="Delete Contact" Click="ContactMenuItem_Click"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<Grid>
<Rectangle Fill="{StaticResource PhoneAccentBrush}"
Width="72" Height="72">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="/Images/defaultContactImage.png" Stretch="UniformToFill"/>
</Rectangle.OpacityMask>
</Rectangle>
</Grid>
<StackPanel>
<TextBox Text="{Binding Name}" TextWrapping="Wrap" Visibility="Collapsed"/>
<TextBlock Text="{Binding Name}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" />
<TextBlock Text="{Binding Number}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextAccentStyle}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
我想有几种方法可以解决这个问题,但我尝试过没有办法.
我目前的做法是这样的
private void ContactListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ListBoxItem listBoxItem = ContactListBox.SelectedItem as …
Run Code Online (Sandbox Code Playgroud) 我有以下XAML(带有自定义DataTemplate的简单列表框).我正在试图弄清楚如何突出显示所选项目(可能是背景颜色变化).我想我需要在Expression Blend中使用Styles做一些事情,但我不太确定从哪里开始......编辑:经过一段时间的游戏我现在有了这个(似乎什么也没做)
<phone:PhoneApplicationPage
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
x:Class="SqueezeBox.StartPage"
d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<Style x:Key="HighlightItemStyle" TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<StackPanel x:Name="DataTemplateStackPanel" Orientation="Horizontal">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" To="Selected">
<Storyboard>
<ColorAnimation Duration="0" To="#FFFD0D0D" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="ItemText" d:IsOptimized="True"/>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Unselected"/>
<VisualState x:Name="Selected"/>
<VisualState x:Name="SelectedUnfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Image x:Name="ItemImage" Source="{Binding ThumbnailAlbumArtUri}" Height="62" Width="62" VerticalAlignment="Top" Margin="10,0,20,0"/>
<StackPanel x:Name="stackPanel">
<TextBlock x:Name="ItemText" Text="{Binding Name}" Margin="-2,-13,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}" d:IsHidden="True"/> …
Run Code Online (Sandbox Code Playgroud) 我需要更改控件的状态然后执行一些操作.具体来说,我想在隐藏控件之前运行动画.我想做那样的事情:
VisualStateManager.GoToState(control, "Hidden", true); // wait until the transition animation is finished
ParentControl.Children.Remove(control);
Run Code Online (Sandbox Code Playgroud)
问题是过渡动画是异步运行的,因此在动画启动后立即从可视树中删除控件.
那我该如何等待动画完成呢?
如何从设置中获取设备的屏幕分辨率(Windows Phone)?
c# silverlight silverlight-3.0 silverlight-4.0 windows-phone-7