Hello,
I'm a beginner in WPF and I need your help to do something.
I want to add a system to close tabs for users. But I can't do it !
I found a video here : http://tv.telerik.com/wpf/prism/introduction-prism-with-radcontrols-wpf and I use the same thing for RadTabControl. So I'm using MS Composite Application Guidance and the RegionManager.
So I have this code id my main project :
In my Module Project I copy the code on the video :
It work ! But now I want to add a close system. So I search the solution in this forum and I found this : How to Add Close Button to the Tab Headers
So I complete my code in my main project like this :
But only close button appear and not the header text.
So how I can use this two solution to have "Header text + close button" please ?
If you need more informations or others, tell me.
Thank you in advance.
Best Regards
I'm a beginner in WPF and I need your help to do something.
I want to add a system to close tabs for users. But I can't do it !
I found a video here : http://tv.telerik.com/wpf/prism/introduction-prism-with-radcontrols-wpf and I use the same thing for RadTabControl. So I'm using MS Composite Application Guidance and the RegionManager.
So I have this code id my main project :
| <telerik:RadTabControl Name="tabControlClient" DockPanel.Dock="Right" cal:RegionManager.RegionName="MainRegion" Margin="10 0 10 10" ScrollMode="Viewport" DropDownDisplayMode="Visible" DisplayMemberPath="Content"> |
| <telerik:RadTabControl.ItemContainerStyle> |
| <Style TargetType="{x:Type telerik:RadTabItem}"> |
| <Setter Property="Header" Value="{Binding DataContext.HeaderInfo}" /> |
| <Setter Property="Height" Value="25" /> |
| <Setter Property="IsSelected" Value="True" /> |
| </Style> |
| </telerik:RadTabControl.ItemContainerStyle> |
| </telerik:RadTabControl> |
In my Module Project I copy the code on the video :
| public String HeaderInfo |
| { |
| get { return "Labs Module"; } |
| } |
| #region INotifyPropertyChanged Membres |
| public event PropertyChangedEventHandler PropertyChanged; |
| protected void OnPropertyChanged(String propertyName) |
| { |
| if (this.PropertyChanged != null) |
| { |
| this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
| } |
| } |
It work ! But now I want to add a close system. So I search the solution in this forum and I found this : How to Add Close Button to the Tab Headers
So I complete my code in my main project like this :
| <telerik:RadTabControl Name="tabControlClient" DockPanel.Dock="Right" cal:RegionManager.RegionName="MainRegion" Margin="10 0 10 10" ScrollMode="Viewport" DropDownDisplayMode="Visible" DisplayMemberPath="Content"> |
| <telerik:RadTabControl.ItemContainerStyle> |
| <Style TargetType="{x:Type telerik:RadTabItem}"> |
| <Setter Property="Header" Value="{Binding DataContext.HeaderInfo}" /> |
| <Setter Property="HeaderTemplate"> |
| <Setter.Value> |
| <DataTemplate> |
| <Grid> |
| <TextBlock Text="{Binding Header}"></TextBlock> |
| <Button Grid.Column="1" Margin="3 0 0 0" Content="x" Width="16" |
| Height="16" HorizontalAlignment="right"/> |
| </Grid> |
| </DataTemplate> |
| </Setter.Value> |
| </Setter> |
| <Setter Property="Height" Value="25" /> |
| <Setter Property="IsSelected" Value="True" /> |
| </Style> |
| </telerik:RadTabControl.ItemContainerStyle> |
| </telerik:RadTabControl> |
But only close button appear and not the header text.
So how I can use this two solution to have "Header text + close button" please ?
If you need more informations or others, tell me.
Thank you in advance.
Best Regards