小编Jus*_*ice的帖子

如何在后面的代码中访问C#Metro UI中的数据模板内的Control

我有一个MediaElement驻留在flipview的datatemplate中,我想在后面的代码中访问名为"video"的MediaElement,这样我就可以通过按钮分配播放,暂停等属性这里是我的代码试图做:

    <FlipView
    x:Name="flipView"
    AutomationProperties.AutomationId="ItemsFlipView"
    AutomationProperties.Name="Item Details"
    TabIndex="1"
    Grid.RowSpan="2"
    ItemsSource="{Binding Source={StaticResource itemsViewSource}}">

    <FlipView.ItemContainerStyle>
        <Style TargetType="FlipViewItem">
            <Setter Property="Margin" Value="0,137,0,0"/>
        </Style>
    </FlipView.ItemContainerStyle>

    <FlipView.ItemTemplate>
        <DataTemplate>
            <UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates">
                <ScrollViewer x:Name="scrollViewer" Style="{StaticResource VerticalScrollViewerStyle}" Grid.Row="1">
                    <Grid Margin="120,0,20,20">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="400" />
                            <ColumnDefinition Width="40" />
                            <ColumnDefinition Width="360" />
                            <ColumnDefinition Width="40" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Border BorderBrush="Black" BorderThickness="1" Width="350" HorizontalAlignment="Left" Grid.Row="0">
                            <MediaElement x:Name="Video" AutomationProperties.Name="Video" Source="/Assets/Big_Buck_Bunny.mp4" HorizontalAlignment="Center" VerticalAlignment="Stretch" Height="250" Width="350" AutoPlay="True" IsLooping="True" />
                        </Border>
                        <Border BorderBrush="Black" BorderThickness="1" Height="65" Width="350" HorizontalAlignment="Left" Grid.Row="1">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Button x:Name="playButton" Margin="0,0" Click="playButton_Click" …
Run Code Online (Sandbox Code Playgroud)

c# xaml windows-8 windows-store-apps

8
推荐指数
1
解决办法
1万
查看次数

如何将图像(.png)转换为base64字符串,反之亦然,并将其转换为指定位置

我正在尝试将图像(png)存储到Windows 8应用程序中的sqlite数据库,我发现它可以通过将其转换为base64字符串并将字符串存储到数据库来完成.稍后在应用程序中我想将该base64字符串转换为png图像并将其存储到指定位置.问题是我不知道如何将图像转换为base64和base64图像并将其存储到c#windows 8 app中的指定位置.任何帮助,将不胜感激.

c# windows-8

7
推荐指数
1
解决办法
1万
查看次数

排序数组,使所有正数首先出现

我在c#中编写一个代码来排序一个数组,我希望右侧的所有负值和左侧的所有正值,不应该按降序排列

namespace SortApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] newInt = new int[] { 5, -2, -1, -4, -20, 6, 7, -14, 15, -16, 8, 9, 10 };
            int size = 12, i= 0;             // or newInt.Length

            for (i = 0; i < newInt.Length; i++)
            {
                if (newInt[i] < 0 && newInt[size] > 0)
                {
                    int temp = newInt[i];
                    newInt[i] = newInt[size];
                    newInt[size] = temp;
                    size--;
                }
            }
            for (i = 0; i < newInt.Length; i++) …
Run Code Online (Sandbox Code Playgroud)

c# arrays sorting

3
推荐指数
1
解决办法
3009
查看次数

命令一个字符数组,使所有的元音出现在最后

我正在尝试编写一个程序,其中一个单词作为字符串被提供作为输入,我必须重新排列单词,以便它只是通过将所有元音移动到结尾来改变单词中字母的顺序,保持它们的顺序与它们在原始单词中出现的顺序相同

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string word = "application";
            char[] letters = word.ToCharArray();
            char x = new char { };
            for (int j = 0; j < letters.Length; j++)
            {
                if ((letters[j] == 'a') | (letters[j] == 'e' ) | (letters[j] == 'i' ) | (letters[j] == 'o' ) | (letters[j] 

== 'u'))
                {
                    for (int i = 0; i < letters.Length - 1; i++)
                    {
                        x = letters[i];
                        letters[i] = letters[i + …
Run Code Online (Sandbox Code Playgroud)

c# arrays sorting

3
推荐指数
1
解决办法
2561
查看次数

标签 统计

c# ×4

arrays ×2

sorting ×2

windows-8 ×2

windows-store-apps ×1

xaml ×1