Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: prism: problems with dynamically adding tabitems

$
0
0

Hi,

As a starting point, regarding the problem to show the corresponding Tab Header, I believe you could check the bindings used inside theDataTemplate, like the TextBlock that defines the header name, take into account that you can't directly bind view models properties from inside aDataTemplate like shown above.

For example I believe you could try the approach mentioned in this blog post , in other words the binding in your TextBlock could result in something like this if you want to bind theHeaderInfo property exposed by the view model:

<TextBlock VerticalAlignment="Center" Margin="3" Text="{Binding Path=DataContext.DataContext.HeaderInfo, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabItem}}}"/>

Also, a similar binding should be applied to the button command.

As an alternative approach you could also use Style setters to define theTabControl.ItemContainerStyle, as an example of this approach I believe you could check the ImageInTabHeaderSample.zip sample proposed in this Work Item.

Regarding the duplicated views so far, I couldn't find the cause of this behavior based on the information you provided.

Regards,

Agustin Adami
http://blogs.southworks.net/aadami


Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>