Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.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
C# 如何向扩展Telerik RadTileViewItem的自定义控件的标题添加按钮?_C#_Asp.net_Wpf_Telerik - Fatal编程技术网

C# 如何向扩展Telerik RadTileViewItem的自定义控件的标题添加按钮?

C# 如何向扩展Telerik RadTileViewItem的自定义控件的标题添加按钮?,c#,asp.net,wpf,telerik,C#,Asp.net,Wpf,Telerik,这是我的自定义控件,它扩展了Telerik RadTileViewItem控件: <telerik:RadTileViewItem x:Class="CrmActivityTimer.Customcontrols.TimerTile" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/

这是我的自定义控件,它扩展了Telerik RadTileViewItem控件:

 <telerik:RadTileViewItem x:Class="CrmActivityTimer.Customcontrols.TimerTile"
         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"
         xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
         DataContext="{Binding RelativeSource={RelativeSource Self}}"
         mc:Ignorable="d" Height="525" Width="375" TileStateChanged="TimerTile_OnTileStateChanged">
<telerik:RadTileViewItem.Resources>
    <Style x:Key="TimerTileHeaderStyle">

    </Style>
</telerik:RadTileViewItem.Resources>
<Grid>

    <TextBox Text="{Binding Timer.TimeElapsed}" Width="100px" Height="20px" Margin="102,17,155,437" IsReadOnly="True"/>
    <Button Height="20px" Width="20px" Margin="216,17,121,437" Click="PlayButton_OnClick">
        <Image Source="icons/Play.png" />
    </Button>
    <Button Height="20px" Width="20px" Margin="242,17,95,437" Click="PauseButton_OnClick">
        <Image Source="icons/Pause.png"  />
    </Button>
    <telerik:RadComboBox Name="CboKlant" HorizontalAlignment="Left" Margin="101,79,0,0" VerticalAlignment="Top" Width="230"
                         ItemsSource="{Binding Fields.Accounts}" DisplayMemberPath="Name" SelectedValuePath="AccountId" KeyboardNavigation.TabIndex="1"/>
    <telerik:RadComboBox Name="CboBetreft" HorizontalAlignment="Left" Margin="101,160,0,0" VerticalAlignment="Top" Width="230" KeyboardNavigation.TabIndex="4"
                         DisplayMemberPath="{Binding Fields.BetreftNameField}" SelectedValuePath="{Binding Fields.BetreftIdField}"/>

    <TextBox Name="TxtOnderwerp" HorizontalAlignment="Left" Height="23" Margin="102,50,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" KeyboardNavigation.TabIndex="0"/>
    <Label Content="Onderwerp" HorizontalAlignment="Left" Margin="10,50,0,0" VerticalAlignment="Top" Height="23" Width="87" Padding="0"/>
    <Label Content="Klant" HorizontalAlignment="Left" Margin="9,78,0,0" VerticalAlignment="Top" Height="23" Width="87" Padding="0"/>
    <Label Content="Betreft" HorizontalAlignment="Left" Margin="9,159,0,0" VerticalAlignment="Top" Height="23" Width="87" Padding="0"/>
    <telerik:RadComboBox x:Name="CboUser" HorizontalAlignment="Left" Margin="101,188,0,0" VerticalAlignment="Top" Width="230" KeyboardNavigation.TabIndex="5"
                         ItemsSource="{Binding Fields.Users}" DisplayMemberPath="FullName" SelectedValuePath="SystemUserId" SelectedValue="{Binding Fields.Currentuser}" />
    <Label Content="Gebruiker" HorizontalAlignment="Left" Margin="9,187,0,0" VerticalAlignment="Top" Height="23" Width="87" Padding="0"/>
    <telerik:RadComboBox x:Name="CboService" HorizontalAlignment="Left" Margin="101,216,0,0" VerticalAlignment="Top" Width="230" KeyboardNavigation.TabIndex="6"
                         ItemsSource="{Binding Fields.Services}" DisplayMemberPath="Name" SelectedValuePath="ServiceId"/>
    <Label Content="Service" HorizontalAlignment="Left" Margin="9,215,0,0" VerticalAlignment="Top" Height="23" Width="87" Padding="0"/>
    <Button HorizontalAlignment="Left" Height="35" Margin="296,10,0,0" VerticalAlignment="Top" Width="35" Click="BtnCreateActivity_OnClick">
        <Image Source="icons/Save.png" Width="35"/>
    </Button>
    <telerik:RadComboBox HorizontalAlignment="Left" Margin="101,106,0,0" VerticalAlignment="Top" Width="230" SelectionChanged="CboKoppelingsType_OnSelectionChanged" KeyboardNavigation.TabIndex="2">
        <telerik:RadComboBoxItem Content="Verkoopkans"/>
        <telerik:RadComboBoxItem Content="Job"/>
        <telerik:RadComboBoxItem Content="Ticket"/>
    </telerik:RadComboBox>
    <Label Content="Betreft is een..." HorizontalAlignment="Left" Margin="9,106,0,0" VerticalAlignment="Top" Width="87" Height="22" Padding="0"/>
    <Label Content="Project" HorizontalAlignment="Left" Margin="9,133,0,0" VerticalAlignment="Top" Width="88" Padding="0"/>
    <telerik:RadComboBox Name="CboProject"  HorizontalAlignment="Left" Margin="102,133,0,0" VerticalAlignment="Top" Width="229" KeyboardNavigation.TabIndex="3"
                          ItemsSource="{Binding Fields.Projects}" DisplayMemberPath="New_titel" SelectedValuePath="New_ProjectId" SelectionChanged="CboProject_SelectionChanged" />
    <TextBox Name="TxtVoorKlant" HorizontalAlignment="Left" Height="166" Margin="9,282,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="147"/>
    <TextBox Name="TxtVoorIntern" HorizontalAlignment="Left" Height="166" Margin="176,282,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="155"/>
    <Label Content="Voor de klant" HorizontalAlignment="Left" Margin="9,251,0,0" VerticalAlignment="Top" Width="87" Padding="0"/>
    <Label Content="Intern" HorizontalAlignment="Left" Margin="170,251,0,0" VerticalAlignment="Top" Width="87" Padding="0"/>
</Grid>

我试图在标题中向该控件添加一个按钮,以从TileView中删除该控件的实例。然而,关于这个问题的每个教程都涉及一个带有自定义标题的默认RadTileViewItem。我想修改RadTileViewItem扩展上的标题。我曾尝试在上使用示例代码,以及其他代码,但我要么最终使用所有控件都已就位但没有自定义标头的TimerFile控件,要么使用自定义标头已就位但没有其他控件的TimerFile控件


有人知道我怎么做吗?我已尝试将所有控件移动到模板本身,但我不知道如何执行此操作,我相当确信这应该是可能的,不会出现太多问题。

在WPF中更改控件外观的常用方法是为其提供一个新的
ControlTemplate
,它定义构成所需外观的控件。但是,要做到这一点,您需要从Telerik找到默认的
RadTileViewItem控制模板
XAML,然后用它启动自定义
ControlTemplate


如果您知道如何编写XAML,那么就不难找到默认的
ControlTemplate
的每一部分的作用以及在哪里添加
按钮。有关更多信息,请阅读MSDN上的页面。

谢谢提供此信息。自从我提出这个问题以来,我对它进行了进一步的研究,在对controltemplates和telerik控件的工作有了更好的了解之后,我设法找出了如何覆盖header controltemplate并将其用于header。