Accessing RadTileView1.ItemsSource members from within Custom Control

2 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Nov 2010

    Posted 16 Nov 2010 Link to this post

    as follows:
                // Apply Data Source to Tile View
                this.tileView1.ItemsSource = new TagBoards();
    ---------------------------------------
            <telerik:RadTileView x:Name="tileView1" HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Top" Margin="9,40,0,0">
                <telerik:RadTileView.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" />
                    </DataTemplate>
    --------------------------------------
    Works fine. But how to I access other fields from ItemSource within Custom Control:
    -----------------------------------------
                <telerik:RadTileView.ContentTemplate>
                    <DataTemplate>
                        <telerik:RadFluidContentControl Name="MineViewFluidControl" SmallToNormalThreshold="250, 150"
            NormalToSmallThreshold="250, 150" NormalToLargeThreshold="425, 350"
            LargeToNormalThreshold="425, 350">
                                <telerik:RadFluidContentControl.SmallContent>
                                <my:ZoneMinimum x:Name="MinimumZoneSmall" AlarmNameText="{Binding AlarmNameText}"/>
                            </telerik:RadFluidContentControl.SmallContent>
    ----------------------------------------------------

        /// </summary>
        public partial class ZoneMinimum : UserControl
        {
            public ZoneMinimum()
            {
                InitializeComponent();
            }

            public string ZoneLabelText
            {

                get { return tblkZoneName.Text; }

                set { tblkZoneName.Text = value; }

            }

            public string ItemLabelText
            {

                get { return tblkItemName.Text; }

                set { tblkItemName.Text = value; }

            }

            public string AlarmNameText
            {

                get { return tblkAlarmName.Text; }

                set { tblkAlarmName.Text = value; }

            }

            public string TruckTotalText
            {

                get { return tblkTruckTotal.Text; }

                set { tblkTruckTotal.Text = value; }

            }

            public string AlarmTotalText
            {

                get { return tblkAlarmTotal.Text; }

                set { tblkAlarmTotal.Text = value; }

            }
        }

    -------------------------------------------------------------

    No go something about dependancy objects???

    A 'Binding' cannot be set on the 'AlarmNameText' property of type 'ZoneMinimum'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.
  2. David
    David avatar
    2 posts
    Member since:
    Nov 2010

    Posted 16 Nov 2010 Link to this post

    It apears that the Binding is inherited by the Custom Control, therefore {Binding XXXX} works at Custom Control level :-) E.g. no need for attached fields etc.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top