Windows phone 8 如何在windows phone 8.1的应用程序栏中添加自定义控件?

Windows phone 8 如何在windows phone 8.1的应用程序栏中添加自定义控件?,windows-phone-8,windows-phone,windows-phone-8.1,Windows Phone 8,Windows Phone,Windows Phone 8.1,我想添加自定义控件,如windows phone 8.1中应用程序栏的第二部分中的滑块或按钮,如camera应用程序的应用程序栏中的按钮。 知道怎么做吗 看来,我的解决方案只在designer中有效,尝试了另一个,但也只在designer中有效。因此,我得出结论,除了默认按钮之外,不可能在commandbar中添加任何内容,我的尝试如下: 我尝试将此样式应用于AppBarButon,按钮在designer中更改为slider,但在手机上它的样式已被覆盖 <Style x:Key="But

我想添加自定义控件,如windows phone 8.1中应用程序栏的第二部分中的滑块或按钮,如camera应用程序的应用程序栏中的按钮。


知道怎么做吗

看来,我的解决方案只在designer中有效,尝试了另一个,但也只在designer中有效。因此,我得出结论,除了默认按钮之外,不可能在commandbar中添加任何内容,我的尝试如下:

我尝试将此样式应用于AppBarButon,按钮在designer中更改为slider,但在手机上它的样式已被覆盖

<Style x:Key="ButtonStyle1" TargetType="Button">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderBrush" Value="{ThemeResource PhoneForegroundBrush}"/>
            <Setter Property="Foreground" Value="{ThemeResource PhoneForegroundBrush}"/>
            <Setter Property="BorderThickness" Value="{ThemeResource PhoneBorderThickness}"/>
            <Setter Property="FontFamily" Value="{ThemeResource PhoneFontFamilyNormal}"/>
            <Setter Property="FontWeight" Value="{ThemeResource PhoneButtonFontWeight}"/>
            <Setter Property="FontSize" Value="{ThemeResource TextStyleLargeFontSize}"/>
            <Setter Property="Padding" Value="9.5,0"/>
            <Setter Property="MinHeight" Value="{ThemeResource PhoneButtonMinHeight}"/>
            <Setter Property="MinWidth" Value="{ThemeResource PhoneButtonMinWidth}"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid x:Name="Grid" Background="Transparent">
                            <Slider ValueChanged="RangeBase_OnValueChanged"  Width="100" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
从这些代码中可以得出一个明显的结论,就是你要做的不是不可能,就是我忽略了一些东西


(可能我忽略了什么)

您可能想更改这些按钮的ControlTemplate,您当然可以插入滑块there@quirell你能告诉我怎么做吗?好的,当我在电脑前的时候我会告诉你,几小时后,但只要在“混合”中打开你的页面,在“设计”窗格上按“普通”按钮,编辑样式,在那里添加滑块,并将此样式应用于appbarbutton,如有必要work@ac-首先,实验室的摄像头应用程序实际上没有AppBar。按下底部三个点打开的控件是该相机应用程序开发人员制作的自定义控件。检查该控件的打开和关闭动画,并尝试将其与实际AppBar控件的动画相关联。你会发现那个应用程序的开发者,使用了一个自定义的uesr控件,和底部的AppBar一样,并在应用程序中使用了它。我也被这个问题困扰了一段时间。我只是对微软IE团队如何在WP8浏览器的appbar中添加一个文本框控件感到困惑——除非他们从头开始重新创建整个东西?
 public sealed class CommandBarSlider : Slider, ICommandBarElement
    {
        public CommandBarSlider()
        {
            this.DefaultStyleKey = typeof(Slider);
        }

        public bool IsCompact { get; set; }
    }