Telerik Forums
UI for WPF Forum
7 answers
536 views

Hi,

I take the Dynamic Layer example and i try to replace the points by the polylines.

internal List<PolylineData> GetFeatures(
            double upperLeftLat,
            double upperLeftLong,
            double lowerRightLat,
            double lowerRightLong,
            GeomType storeType)
        {
            try
            {
                PolylineData polyline1 = new PolylineData()
                {
                    ShapeFill = new MapShapeFill()
                    {
                        Stroke = new SolidColorBrush(Colors.Red),
                        StrokeThickness = 2
                    }
                };
 
                LocationCollection pt = new LocationCollection
                {
                    new Location(44.6957539183824, 23.3327663758679),
                    new Location(44.1429369264591, 24.7498095849434),
                    new Location(44.5131732087098, 27.4611884843576),
                    new Location(45.2073941930888, 27.9275176988258)
                };
 
                polyline1.Points = pt;
                _listPolylineDatas.Add(polyline1);
                return _listPolylineDatas;

 

But i have an exception : {"Must create DependencySource on same Thread as the DependencyObject."}

Do you have an solution for this issue ?

 

Thank you

Martin Ivanov
Telerik team
 answered on 11 Feb 2016
1 answer
90 views

Hi,

 

in my XAML I use the following TemplateSelector to have a button beside my "SourceFile" property to open a FileDialog to select a filename:

            <local:PropertyGridTemplateSelector x:Key="dataTemplateSelector">
                <local:PropertyGridTemplateSelector.SourceFilePropertyTemplate>
                    <DataTemplate>
                        <Grid Margin="0,0,2,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBox Text="{Binding SourceFile}" Grid.Column="0"/>
                            <Button Content="..." Width="25" Height="25" Grid.Column="1" Click="SelectFileClick"/>
                        </Grid>
                    </DataTemplate>
                </local:PropertyGridTemplateSelector.SourceFilePropertyTemplate>
                <!-- More templates here -->
            </local:PropertyGridTemplateSelector>

 

    public class PropertyGridTemplateSelector : DataTemplateSelector 
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            PropertyDefinition dpi = item as PropertyDefinition;
            
            if (dpi.DisplayName == "SourceFile")
            {
                return SourceFilePropertyTemplate;
            }

            return null;
        }

        public DataTemplate SourceFilePropertyTemplate { get; set; }
    }

 

when I select a file through my file dialog,I want to update the recontrol to reflect the selection I made in my file dialog...

 

Thank's

Alain

Dilyan Traykov
Telerik team
 answered on 11 Feb 2016
1 answer
170 views

Hi, 

I'm making an application which represents data in a GridView and ScheduleView at the same time.

Now I'm looking for a way to bind GridView's rows heights to a ScheduleView row heights to synchronize both components grid lines while scrolling (I have implemented gridview scrolling with scheduleview scrollbar and that was pretty easy).

Sure, I can hardcode GroupHeader height with group header content template selector, but it won't work for a case when few appointments stretches a group.

So, basically I have to get current row heights from ScheduleView, how can I get them even from code-behind?

Twi pics in the attachment.

 

Many thanks,

Denis.

 

Yana
Telerik team
 answered on 11 Feb 2016
1 answer
1.9K+ views

Hi @ll,

 

first: our basics

  • wpf application with implicit styles
  • user is allowed to change the theme on the fly

Now I want to use different foreground colors of a TextBlock

to illustrate a special meaning. Therefore I use the following style:

<Style TargetType="{x:Type TextBlock}" x:Key="CompareStatusStyle">
    <Style.Triggers>
        <DataTrigger Binding="{Binding Status}" Value="{x:Static vm:CompareStatus.Different}">
            <Setter Property="Foreground" Value="Orange"/>
        </DataTrigger>
        <DataTrigger Binding="{Binding Status}" Value="{x:Static vm:CompareStatus.OnlyA}">
            <Setter Property="Foreground" Value="Red"/>
        </DataTrigger>
        <DataTrigger Binding="{Binding Status}" Value="{x:Static vm:CompareStatus.OnlyB}">
            <Setter Property="Foreground" Value="ForestGreen"/>
        </DataTrigger>
        <DataTrigger Binding="{Binding Status}" Value="{x:Static vm:CompareStatus.Unknown}">
            <Setter Property="Foreground" Value="Gray"/>
        </DataTrigger>
    </Style.Triggers>
</Style>

 

This works mostly very well.

But when I used this Style inside a RadTreeView (header) there are some

problems with background colors. (see the attached image)

 

My question: what is the best way to define colors which might be change

using a different theme or adapt automatically to the background.

 

I found a bad way: using code behind to change the background color

of the SelectionVisual of a RadTreeViewItem. But unfortunately not every

theme is build in the same way and the border defining the background

color is not in path from my content to the RadTreeItem, so finding the

current background color is hard.

 

Has anyone an idea how I can solve this?

 

Thanks a lot.

Best regards

Christian

 

Martin Ivanov
Telerik team
 answered on 11 Feb 2016
8 answers
237 views
I am trying to find the right syntax to add a drop shadow via code behind.
Masha
Telerik team
 answered on 11 Feb 2016
2 answers
263 views

I've set my grid to include this property setting: SelectionMode="Multiple" 

From reading the documentation --  You can select a set of grid rows (not necessarily neighboring). Hold the Ctrl key and click on the rows which you want to be selected. -- I would expect this to behave as a standard multi-select scenario just like any Windows control. However, SelectionMode="Multiple" causes my grid to select each row on which I click -- with or without the Ctrl modifier. I need users to be able to select a new row without having to deselect the original row. It seemed like it should be pretty straightforward, but I'm clearly missing something.

Thanks...

 
 
 
Mark
Top achievements
Rank 1
 answered on 11 Feb 2016
2 answers
131 views
I am using below code snippet but not getting end date on xaxis.[Please refer attached screen print.]
 
I need to show end date irrespective of (Odd/Even)number points. Can you please suggest how to achieve this.
 
public DateTimeContinuousAxis SetTimeInterval(DateTimeContinuousAxis xAxis, int dateCount)
      {
          var range = xAxis.Maximum - xAxis.Minimum;
          double lbs = System.Math.Ceiling(range.TotalDays / 10);
 
          if (lbs > 0 && range.TotalDays / lbs > 5)
          {
              xAxis.MajorStepUnit = TimeInterval.Day;
              xAxis.LabelInterval = 3;//(int)Math.Round(lbs);
              xAxis.LastLabelVisibility = Telerik.Charting.AxisLastLabelVisibility.Visible;
              xAxis.MajorStep = range.TotalDays;
          }
 
          return xAxis;
      }
Dinko | Tech Support Engineer
Telerik team
 answered on 11 Feb 2016
2 answers
151 views

Hi!

I'm trying to add an inline image to a RadRichTextBox by dragging and dropping the image from elsewhere in my application. I noticed that sometimes the image goes partially on top of the previous line as shown in the attached picture. Even when changing the wrapping style between square and top-and-bottom, it doesn't get fixed. 

I wonder what's causing this? Is there a way to work around this? Could it be just my Visual Studio?

Thanks!

Tinja

 

Tinja
Top achievements
Rank 1
 answered on 11 Feb 2016
7 answers
602 views

Hi,

I've been struggling a bit with the radgridview since the Itemssource can be updated somewhere else, but the thing is, it's the full collection that gets updated, and when this happens, the entire sorting/filter is lost.

I assume I have to make sure that only one specific item in the collection gets modified, but not quite sure what the best approach is here, since the collection is filled with Telerik DataAccess entities and if I'm not wrong there is not Inotifyproperty on the entities.

Heiko
Top achievements
Rank 1
 answered on 10 Feb 2016
4 answers
114 views

I'm using a RadToolBar in an Excel task pane. When the task pane is sized to move controls to the overflow, the overflow button will enable but clicking the overflow button will not display the controls. I've further narrowed the problem to when the WPF user control is converted to an INativeControlHandle and back before adding it to the task pane.

 

I've built a sample project to demonstrate the problem. The sample also includes a regular WPF ToolBar which does not have the same problem. (remove the .jpg extension from the .zip file)

 

Note that the same code hosted in a Word addin will function correctly as will a generic WinForms application.

 

Any advice would be appreciated.

klac
Top achievements
Rank 1
 answered on 10 Feb 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?