We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TabControlExt ItemTemplate Binding to MVVM Property of DataContext

Thread ID:

Created:

Updated:

Platform:

Replies:

128455 Jan 24,2017 09:36 AM UTC Jan 26,2017 01:47 PM UTC WPF 3
loading
Tags: TabControlExt
Benjamin Siegmund
Asked On January 24, 2017 09:36 AM UTC

Hello,

we have a problem with the TabControlExt ItemTemplate.
We want to use a Property of our ViewModel (MVVM Style with PRISM) to show the Title of the TabItem.
But as we can see, the TabItem could not reach the properties of the TabControl content.
In the content we display view dynamically loaded.

Is there any option the get the properties or set the title by binding to the viewmodel presented in the content area?
In order to that problem, is there also an option to set the closing icon dynamically with a property of the viemodel?
Not all of our views should be closed by the user itself.

An example of the code:

<sf:TabControlExt x:Name="Tab"
                      prism:RegionManager.RegionName="{x:Static modinf:ModuleRegionNames.ModulPosteingangTabRegion}"
                      AllowDragDrop="false"
                      CloseButtonType="Hide"
                      EnableLabelEdit="False"
                      RotateTextWhenVertical="true"
                      ShowTabItemContextMenu="False"
                      ShowTabListContextMenu="False"
                      TabItemLayout="SingleLine"
                      TabItemSize="Normal"
                      TabScrollButtonVisibility="Auto"
                      TabScrollStyle="Extended"
                      TabStripPlacement="Top">
        <sf:TabControlExt.ItemTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Path=DataContext.ViewModelTitel}" />
            </DataTemplate>
        </sf:TabControlExt.ItemTemplate>
We tried Content.DataContext., only Datacontext. and without.

Thanks and best regards
Ben

Durga Rajan [Syncfusion]
Replied On January 25, 2017 09:10 AM UTC

Hi Benjamin Siegmund,

Thank you for contacting Syncfusion support.

We have prepared a sample to meet your requirement. In the sample, we have bound the Header property of Model to TabItem Header using ItemContainerStyle property of TabControlExt. Using BoolToCloseTypeConverter and CanClose property in Model, we have changed the CloseButtonType of TabControlExt to avoid displaying close button for few tab items. You can download the sample for the same from the following location.

Sample: TabControlExt_Prism_Sample

If we have misunderstood your query, please get back to us with more details about your ​​​requirement. This would help us to provide solution at earliest.

Regards,
Durga S.

Benjamin Siegmund
Replied On January 26, 2017 06:42 AM UTC

Hello Durga S.,

thank you for your fast reply. It works fine. Thanks a lot :)

Marimuthu Sivalingam [Syncfusion]
Replied On January 26, 2017 01:47 PM UTC

Hi Benjamin,

We are glad to know that your issue has been solved. Please let us know if you need any further assistance.

Regards,
Marimuthu S.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;