0

RadDataFilter ControlTemplatesをオーバーライドしようとしていて、Custom UserControl を使用しました。クラスに 2 つの依存関係プロパティがあります。

  public static readonly DependencyProperty SelectedItemProperty =
      DependencyProperty.Register("SelectedItem", typeof(object), typeof(CustomControl), new UIPropertyMetadata());

  public object SelectedItem
  {
     get { return (object)GetValue(SelectedItemProperty); }
     set { SetValue(SelectedItemProperty, value); }
  }

  public static readonly DependencyProperty ItemsSourceProperty =
        DependencyProperty.Register("ItemsSource"
        , typeof(IEnumerable)
        , typeof(CustomControl));
        //, new PropertyMetadata(RadDataFilter.OnItemsSourcePropertyChanged));

  public IEnumerable ItemsSource
  {
     get
     {
        return this.GetValue(ItemsSourceProperty) as IEnumerable;
     }
     set
     {
        this.SetValue(ItemsSourceProperty, value);
     }
  }

そして私のXAMLで:

<UserControl x:Class="RADDataFilterExample.CustomControl"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" >
    <StackPanel Orientation="Horizontal">
        <Button Content="Shankar" Click="Button_Click" />
    </StackPanel>
</UserControl>

このコントロールを使用している場所は次のとおりです。

<local:CustomControl x:Name="PART_SimpleFilterMemberComboBox" Content="Finally!!"
                                        Margin="0,0,3,0" MinWidth="100" VerticalAlignment="Center"
                                        ItemsSource="{Binding SimpleFilter.AvailableMembers}"
                                        SelectedItem="{Binding SimpleFilter.SelectedMember, Mode=TwoWay}" />

ここで、SimpleFilter.AvailableMembers と SimpleFilter.SelectedMember は Telerik ソース コードの一部です。

私の質問は、CustomControl から SelectedItem プロパティを設定するにはどうすればよいですか?

私にお知らせください。

4

1 に答える 1