//NewsItemTemplate

        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            try
            {
                RssDataItem dataItem = item as RssDataItem;

                if (dataItem.Group.UniqueId.Contains("MainNews") || dataItem.Group.UniqueId.Contains("Tourist"))
                //dataItem.Group.UniqueId.Contains("http://rybinsk.ru/news-2013?format=feed") ||
                {
                    return(Template1);
                }
                else
                {
                    return(Template1);
                };
            }
            catch {
                return(Template2);
            };
        }
示例#2
0
        protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
        {
            try
            {
                RssDataItem dataItem = item as RssDataItem;
                int         index    = -1;

                int group = -1;

                if (dataItem.Group.UniqueId.Contains("stas"))
                {
                    group = 1;
                }

                if (dataItem != null)
                {
                    index = dataItem.Group.Items.IndexOf(dataItem);
                }
                ;

                colVal = 2;
                rowVal = 2;

                /*if (index == 1)
                 * {
                 *  colVal = 2;
                 *  rowVal = 4;
                 * }
                 * else
                 * {
                 *  colVal = 2;
                 *  rowVal = 2;
                 * }*/

                if (index == 2)
                {
                    colVal = 2;
                    rowVal = 4;
                }

                if (index == 5)
                {
                    colVal = 4;
                    rowVal = 4;
                }

                if (group > 0)
                {
                    if (index == 2)
                    {
                        colVal = 2;
                        rowVal = 4;
                    }

                    if (index == 5)
                    {
                        colVal = 4;
                        rowVal = 4;
                    }
                }

                VariableSizedWrapGrid.SetRowSpan(element as UIElement, rowVal);
                VariableSizedWrapGrid.SetColumnSpan(element as UIElement, colVal);
            }
            catch { };

            base.PrepareContainerForItemOverride(element, item);
        }