Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1585
XamOutlookBar Binding
posted

I am trying to do some simple binding with the XamOutlookBar.

The control seems to be binding but for some reason it looks as if the DataTemplates are not being applied. Here is my code... this is a very simple example I am working with...I must have missed something with the binding, I have used other controls from Infragistic and never had this issue...

Instead of using the bound object property respectively it just shows the object path... Here is a screen shot of the rendered page...

 

Here is my XAML

<UserControl xmlns:ig="">schemas.infragistics.com/xaml"  x:Class="SilverlightApplication1.MainPage"
    xmlns="">schemas.microsoft.com/.../presentation"
    xmlns:x="">schemas.microsoft.com/.../xaml"
    xmlns:d="">schemas.microsoft.com/.../2008"
    xmlns:mc="">schemas.openxmlformats.org/.../2006"
      
    mc:Ignorable="d"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
        
    >

    <UserControl.Resources>
        <DataTemplate x:Key="group2Template">
            <ig:OutlookBarGroup>
                <ig:OutlookBarGroup.HeaderTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding ItemName}" />
                    </DataTemplate>
                </ig:OutlookBarGroup.HeaderTemplate>

                <ig:OutlookBarGroup.ContentTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding ItemName}" />
                    </DataTemplate>
                </ig:OutlookBarGroup.ContentTemplate>
            </ig:OutlookBarGroup>


        </DataTemplate>
    </UserControl.Resources>
  
    <Grid x:Name="LayoutRoot">
        <ig:XamOutlookBar x:Name="test"
                 HorizontalAlignment="Stretch"
                 DefaultGroupsContainer="{StaticResource group2Template}"
                 >
          </ig:XamOutlookBar>
    </Grid>
</UserControl>

 

Any my code behind....

    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            MockModel mm = new MockModel();

            for(int i = 0; i < 3; i++){
                MockNode mn = new MockNode();
                mn.ItemName = String.Format("Node {0}", i);
                mm.Nodes.Add(mn);
            }
            this.test.GroupsSource = mm.Nodes;
        }
    }
    public class MockModel
    {
        public ObservableCollection<MockNode> Nodes;

        public MockModel()
        {
            Nodes = new ObservableCollection<MockNode>();
        }
    }

    public class MockNode
    {

        public string ItemName {get;set;}
        public string ImageURL {get;set;}
    }