Telerik Forums
UI for WPF Forum
14 answers
292 views
Hi,
I have a little problem when i use the TileView control in conjonction with the RadfluidContentControl : the datacontext is not inherited by the ContentElement child.
Here is my code:
<Window.Resources>
    <local:TileConverter x:Uid="conv:TileConverter_1"
                        x:Key="TileConverter" />
          
    <Style x:Uid="Style_17"
            TargetType="telerik:RadTileView"
            x:Key="TileGraphStyle">
        <Setter x:Uid="Setter_185"
                Property="IsItemDraggingEnabled"
                Value="True" />
        <Setter x:Uid="Setter_186"
                Property="MaximizeMode"
                Value="One" />
        <Setter x:Uid="Setter_187"
                Property="IsItemsAnimationEnabled"
                Value="False" />
        <Setter x:Uid="Setter_188"
                Property="PreservePositionWhenMaximized"
                Value="True" />
        <Setter x:Uid="Setter_189"
                Property="telerik:TileViewPanel.IsVirtualized"
                Value="True" />
        <Setter x:Uid="Setter_190"
                Property="IsAutoScrollingEnabled"
                Value="True" />
        <Setter x:Uid="Setter_191"
                Property="TileStateChangeTrigger"
                Value="SingleClick" />
        <Setter x:Uid="Setter_192"
                Property="MinimizedColumnWidth"
                Value="300" />
        <Setter x:Uid="Setter_193"
                Property="MinimizedRowHeight"
                Value="300" />
        <Setter x:Uid="Setter_194"
                Property="MinimizedItemsPosition"
                Value="Left" />
    </Style>
  
    <DataTemplate x:Key="LargeTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Background="AliceBlue"
                        Text="This is LargeTemplate" />
            <TextBlock Background="AliceBlue"
                        Text="{Binding Text}" />
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="SmallTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Background="Azure"
                        Text="This is SmallTemplate" />
            <TextBlock Background="Azure"
                        Text="{Binding Text}" />
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="RadFluidContentControlTemplate">
        <telerik:RadFluidContentControl ContentChangeMode="Manual"
                                        TransitionDuration="0:0:.5"
                                        LargeContentTemplate="{StaticResource LargeTemplate}"
                                        SmallContentTemplate="{StaticResource SmallTemplate}"
                                        ContentTemplate="{StaticResource SmallTemplate}"
                                        State="{Binding TileState, Converter={StaticResource TileConverter}}">
        </telerik:RadFluidContentControl>
    </DataTemplate>
</Window.Resources>
<Grid>
    <telerik:RadTileView x:Uid="tileView1"
                            x:Name="tileView1"
                            IsDockingEnabled="True"
                            Style="{StaticResource TileGraphStyle}"
                            ContentTemplate="{StaticResource RadFluidContentControlTemplate}"
                            ItemsSource="{Binding Items}">
        <telerik:RadTileView.ItemTemplate>
            <DataTemplate x:Uid="DataTemplate_4">
                <TextBlock x:Uid="TextBlock_11"
                            Text="{Binding Level}" />
            </DataTemplate>
        </telerik:RadTileView.ItemTemplate>
    </telerik:RadTileView>
</Grid>

The viewmodels :
public class MainViewModel : ViewModelBase
{
    public MainViewModel()
    {
        this.Items = new List<Item>()
        {
            new Item() { Level = 1, Text ="AAAA"},
            new Item() { Level = 2, Text ="BBBB"},
            new Item() { Level = 3, Text ="CCCC"},
            new Item() { Level = 4, Text ="DDDD"},
        };
    }
  
    public IList<Item> Items { get; private set; }
}
  
public class Item : ViewModelBase
{
    private TileState tileState;
    public int Level { get; set; }
    public string Text { get; set; }
    public TileState TileState
    {
        get
        {
            return this.tileState;
        }
  
        set
        {
            if (this.tileState != value)
            {
                this.tileState = value;
                this.NotifyPropertyChanged("TileState");
            }
        }
    }
}

If i suppress the  RadfluidContentControl all is fine and i see the right text displayed.
Any clues ?

- Cedric -
 
Patrick
Top achievements
Rank 1
 answered on 16 May 2016
1 answer
119 views

Hi Team,

 

I'm new to telerick controls and using image editor control. i would like to know how to change theme for this control like i want to configure visual studio 2013 dark theme;

 

Give some sample code or explain the steps.

 

Regards

Hema

Tanya
Telerik team
 answered on 16 May 2016
3 answers
161 views

With a basic RadPropertyGrid, if I set the Item to an object with a System.Windows.Media.Color property, when I pick a color in the editor, it will properly call the property setter and update Test1's Color value.

 

public class Test1
{
    public System.Windows.Media.Color Color { get; set; }
}

 

If I use the following Test2 class instead, changing the color in the property grid will not call the property setter and the value in the box will not get updated.

public class Test2 : INotifyPropertyChanged
{
    public System.Windows.Media.Color Color { get; set; }
    public event PropertyChangedEventHandler PropertyChanged;
}

Dilyan Traykov
Telerik team
 answered on 16 May 2016
3 answers
310 views

Hi,

We're using version 2015.2.728.45 of Telerik UI for WPF and we are encountering an issue with the hyperlink dialog. Here is the related xaml code used in the ribbon of the application:

<telerik:RadRibbonButton LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/inserthyperlink.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ShowInsertHyperlinkDialogCommand}" telerik:ScreenTip.Description="Create a link to a Web page, a picture or an e-mail address." telerik:ScreenTip.Title="Insert Hyperlink" Size="Large" Text="Hyperlink" />

Each time we insert/update an hyperlink using the "Insert Hyperlink" modal dialog, we get an extra "http://" prefix added to the beginning of the address. What should we do to avoid this behaviour?

Thanks for your help,

Sébastien

Tanya
Telerik team
 answered on 16 May 2016
0 answers
151 views

Hi,

At the moment, upon loading my usercontrol, I programatically load all my calendar events. I export my outlook calendar folder then import it into the schedule view. I'm wondering what is the best approach to integrate with outlook? I created methods to trigger OnAppointmentDelete and OnAppointmentCreate, such that it'll update outlook. But is this the ideal solution? 

 

        private void LoadOutlook()
        {
            try
            {
                var outlook = new ApplicationClass();
                var OutlookNS = outlook.GetNamespace("MAPI");

                MAPIFolder f = OutlookNS.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);

                CalendarSharing cs = f.GetCalendarExporter();
                cs.CalendarDetail = OlCalendarDetail.olFullDetails;
                cs.StartDate = new DateTime(2011, 11, 1);
                cs.EndDate = new DateTime(2018, 12, 31);
                var tempPath = Path.GetTempPath();
                var tempCalendar = tempPath + "cal.ics";
                cs.SaveAsICal(tempCalendar);
                using (TextReader txtReader = new StreamReader(tempCalendar))
                {
                    this.Import(txtReader);
                }
            }
            catch
            {
                
            }
        }

Minh
Top achievements
Rank 1
 asked on 16 May 2016
6 answers
121 views

So I have a working save/load for my RadPivotGrid with LocalDataProvider, but had performance concerns so added set of wrappers and functionality for QueryableDataProvider.

My wrappers and set with properties (get; set;) of types int, double, string, bool?, string, MyEnum, DateTime[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]

Im not applying any custom aggregates or similar, and in this example I had 1 column, 1 row property and 'count' of ItemID value.

 

The code works fine with LocalDataProvider (though not using wrappers there, instead more complex EF entities), but wit h my lighter QueryableDataProvider datasource it now my export throws an exception when it hits the serialize command `provider.Serialize(this.xPivotGrid_Reports.DataProvider)`

---

An exception of type 'System.Runtime.Serialization.SerializationException' occurred in System.Runtime.Serialization.dll but was not handled in user code

Additional information: Type 'Telerik.Pivot.Queryable.QueryablePropertyAggregateDescription' with data contract name 'QueryablePropertyAggregateDescription:http://schemas.datacontract.org/2004/07/Telerik.Pivot.Queryable' is not expected. Consider using a DataContractResolver if you are using DataContractSerializer or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to the serializer.

---

 

I cant remember original source, but I found the DataContract code online and changed very little.

And I am aware that the DataProviderSerializer subclass (where KnownTypes is defined) is called LocalDataSourceSerializer, but thats part of question: 

Is there another list like `PivotSerializationHelper.KnownTypes` I should be using, because it seems comprehensive enough and im hardly doing anything strange?

 

---

    [DataContract]
    public class DataProviderSettings
    {
        [DataMember]
        public object[] Aggregates { get; set; }

        [DataMember]
        public object[] Filters { get; set; }

        [DataMember]
        public object[] Rows { get; set; }

        [DataMember]
        public object[] Columns { get; set; }

        [DataMember]
        public int AggregatesLevel { get; set; }

        [DataMember]
        public PivotAxis AggregatesPosition { get; set; }
    }

    public class LocalDataSourceSerializer : DataProviderSerializer
    {
        public override IEnumerable<Type> KnownTypes
        {
            get
            {
                return PivotSerializationHelper.KnownTypes;
            }
        }
    }

    public abstract class DataProviderSerializer
    {
        public abstract IEnumerable<Type> KnownTypes { get; }

        public string Serialize(object context)
        {
            string serialized = string.Empty;

            IDataProvider dataProvider = context as IDataProvider;
            if (dataProvider != null)
            {
                MemoryStream stream = new MemoryStream();

                DataProviderSettings settings = new DataProviderSettings()
                {
                    Aggregates = dataProvider.Settings.AggregateDescriptions.OfType<object>().ToArray(),
                    Filters = dataProvider.Settings.FilterDescriptions.OfType<object>().ToArray(),
                    Rows = dataProvider.Settings.RowGroupDescriptions.OfType<object>().ToArray(),
                    Columns = dataProvider.Settings.ColumnGroupDescriptions.OfType<object>().ToArray(),
                    AggregatesLevel = dataProvider.Settings.AggregatesLevel,
                    AggregatesPosition = dataProvider.Settings.AggregatesPosition
                };

                DataContractSerializer serializer = new DataContractSerializer(typeof(DataProviderSettings), KnownTypes);
                serializer.WriteObject(stream, settings);

                stream.Position = 0;
                var streamReader = new StreamReader(stream);
                serialized += streamReader.ReadToEnd();
            }

            return serialized;
        }

        public void Deserialize(object context, string savedValue)
        {
            IDataProvider dataProvider = context as IDataProvider;
            if (dataProvider != null)
            {
                var stream = new MemoryStream();
                var tw = new StreamWriter(stream);
                tw.Write(savedValue);
                tw.Flush();
                stream.Position = 0;

                DataContractSerializer serializer = new DataContractSerializer(typeof(DataProviderSettings), KnownTypes);
                var result = serializer.ReadObject(stream);

                dataProvider.Settings.AggregateDescriptions.Clear();
                foreach (var aggregateDescription in (result as DataProviderSettings).Aggregates)
                {
                    dataProvider.Settings.AggregateDescriptions.Add(aggregateDescription);
                }

                dataProvider.Settings.FilterDescriptions.Clear();
                foreach (var filterDescription in (result as DataProviderSettings).Filters)
                {
                    dataProvider.Settings.FilterDescriptions.Add(filterDescription);
                }

                dataProvider.Settings.RowGroupDescriptions.Clear();
                foreach (var rowDescription in (result as DataProviderSettings).Rows)
                {
                    dataProvider.Settings.RowGroupDescriptions.Add(rowDescription);
                }

                dataProvider.Settings.ColumnGroupDescriptions.Clear();
                foreach (var columnDescription in (result as DataProviderSettings).Columns)
                {
                    dataProvider.Settings.ColumnGroupDescriptions.Add(columnDescription);
                }

                dataProvider.Settings.AggregatesPosition = (result as DataProviderSettings).AggregatesPosition;
                dataProvider.Settings.AggregatesLevel = (result as DataProviderSettings).AggregatesLevel;
            }
        }
    }

---

 

 

 

Daniel B.
Top achievements
Rank 1
 answered on 16 May 2016
0 answers
84 views

I add raddatafilter as following :

<Grid><Grid.Resources><DataTemplate x:Key="CountryComboboxTemplate" ><telerik:RadComboBox x:Name="CountryCombox2" TabIndex="3"HorizontalAlignment="Left" VerticalAlignment="Center"DisplayMemberPath="CountryName" IsTabStop="True"ClearSelectionButtonContent="Clear" ClearSelectionButtonVisibility="Visible"CanAutocompleteSelectItems="True" CanKeyboardNavigationSelectItems="True"IsEditable="True" IsReadOnly="False" IsTextSearchEnabled="True"OpenDropDownOnFocus="True" IsFilteringEnabled="True"TextSearchMode="Contains" IsDropDownOpen="False" SelectedValue="{Binding Value, Mode=TwoWay, FallbackValue=null}"Width="200" Background="{x:Null}" BorderBrush="{x:Null}" Height="30" Foreground="{DynamicResource white-forground}" Margin="0,5" Grid.Row="2" Grid.Column="2"/></DataTemplate><behaviors:EditorTemplateSelector x:Key="MyEditorTemplateSelector"><behaviors:EditorTemplateSelector.EditorTemplateRules><behaviors:EditorTemplateRule PropertyName="Country" DataTemplate="{StaticResource CountryComboboxTemplate}" /></behaviors:EditorTemplateSelector.EditorTemplateRules></behaviors:EditorTemplateSelector></Grid.Resources><telerik:RadDataFilter Name="Filter" telerik:StyleManager.Theme="Windows8"EditorCreated="OnRadDataFilterEditorCreated"Loaded="Filter_Loaded"MinHeight="193"MaxHeight="250"Width="Auto"Grid.Row="0" behaviors:FilterDescriptorBindingBehavior.FilterDescriptors="{Binding FilterDescriptors, Source={StaticResource model}}"EditorTemplateSelector="{StaticResource MyEditorTemplateSelector}"Margin="1" /></Grid>

the problem is the country not fill in the filter always country is equal too empty , not the selected country
and code behind looks like

public FilterDataUserControl(){InitializeComponent();var list = new List<FilterCriterea>();list.Add(new FilterCriterea());Filter.Source = list;}private void OnRadDataFilterEditorCreated(object sender, EditorCreatedEventArgs e){if (DataContext != null){var datacontextVm = DataContext as AdvancedSearchManagerViewModel;if (datacontextVm != null){switch (e.ItemPropertyDefinition.PropertyName){case "Country":RadComboBox countrycomboBoxEditor = (RadComboBox)e.Editor; countrycomboBoxEditor.ItemsSource = datacontextVm.CountryCollectionViewModelIns;break;}}}}private void Filter_Loaded(object sender, RoutedEventArgs e){Filter.ItemPropertyDefinitions.Add(new ItemPropertyDefinition("Country", typeof(Country), "Country"));}}

 

Ali
Top achievements
Rank 1
 asked on 13 May 2016
0 answers
70 views

Hi, I implemented an Autocompletebox within an Edit Appointment's dialog,I was able to set the ItemsSource to be a staticresource of the viewmodel, But I can't seem to set it as a property of my CustomAppointment. May I ask how do I do that.

 

Also upon creation of a new appointment, I send it off to make the changes in outlook as well. But the problem is that the code below is of type IAppointment. How do I get the value of the customappointment OnSchedulerAppointmentCreated 

        private void OnSchedulerAppointmentCreated(object sender, AppointmentCreatedEventArgs e)
        {
            (this.DataContext as CalendarViewModel).NewAppointment((CustomAppointment)e.CreatedAppointment);
        }

Minh
Top achievements
Rank 1
 asked on 13 May 2016
1 answer
69 views
I have added several columns into gridview in the code, the binding is something like a[" + Index + "].b while Index  is a number like 0,1,2. So how to solve the problem since the added column cannot be drag or sort. I have already tried set DataType, seems like not ok.
Stefan
Telerik team
 answered on 13 May 2016
1 answer
79 views

Hey all,

So to start, let me say that I have a project built out to learn with...I'm trying things out just to figure out better patterns and whatnot when building up apps since I've been doing a lot of that lately and I've started a blog to document my experiences.

What I was doing initially was creating a project to figure out which was better to use...a BackgroundWorker or Task for doing background processing of getting a data source for the grid.  What I ended up with was a test app that is buried under a mountain of bad perf and it locks the UI up until it's darn good and ready to let it go.  As far as I can tell in my source code...I'm not attaching any of the BackgroundWorker or Task threads to the UI thread...so I'm pretty confused as to what's going on.

If I just do one at a time, the table starts filling up with data before the RadBusyIndicator can even bring up it's UI...if I try 2 or 3...I start seeing the RadBusyIndicator doing it's thing...but the UI is still responsive.  If I do all 12...the UI is stuck for a good 10 minutes (my test database has more than 250,000 records in each table).

My source files can be found at the following blog post (If you'd rather I posted them here I can do that as well...)

Any thoughts as to what I'm doing wrong?  Thanks in advance.  :)

Stefan
Telerik team
 answered on 13 May 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?