Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight滑块自定义控件属性不可用_Silverlight_Silverlight 4.0_Custom Controls - Fatal编程技术网

Silverlight滑块自定义控件属性不可用

Silverlight滑块自定义控件属性不可用,silverlight,silverlight-4.0,custom-controls,Silverlight,Silverlight 4.0,Custom Controls,我已经用Blend 4创建了一个自定义控件来自定义幻灯片对象。下面是由Blend生成的代码片段: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/ble

我已经用Blend 4创建了一个自定义控件来自定义幻灯片对象。下面是由Blend生成的代码片段:

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    x:Class="SilverlightControlCustomSlider.CustomSlider"
    d:DesignWidth="640" d:DesignHeight="480">
    <UserControl.Resources>
        <Style x:Key="SliderStyle1" TargetType="Slider">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Maximum" Value="10"/>
            <Setter Property="Minimum" Value="0"/>
            <Setter Property="Value" Value="0"/>
            <Setter Property="BorderBrush">

然后,我构建了该项目并将其导入VS2010。我可以创建一个自定义滑块的实例,它具有相同的外观和所有。但是,属性值、最大值和最小值(可能还有其他)不可用。就像自定义控件没有从滑块继承一样。我做错了什么


谢谢

好的,用户控件和自定义控件有很大的区别。尽管我建议您没有发布所有代码,但这里的用户控件似乎包含一个具有自定义样式模板的滑块

因此,基本上,您不是在创建一个包含滑块控件功能的控件,而是在创建一个包含滑块的控件。这意味着您不能直接访问滑块属性,因为Usercontrol不是滑块类型


因此,假设您没有实际更改滑块的任何功能,只是更改了样式,那么您应该重新使用UserControl中的样式模板,并将其作为资源应用于滑块控件。

谢谢,我不知道它是如何工作的!我将该样式应用于滑块,效果非常好!