Telerik Forums
UI for WPF Forum
1 answer
191 views
Hey,

I am trying to make a custom LineTool but i am having some trouble changing the geometry for the inserted shape. Do you guys have some examples of making custom tools, feels like i am missing something, but haven't been able to find any resources on this area.

On MouseMove is create a new GeometryShape and set the geometry data to a line. But it still show a arc geomtry even thoug active shape holds a LineGeometry. Seem like DrawingService.InitializeDraw(shape, "PencilTool"); is wrong but use "LineTool" as paramter will result in no geometry at all.

Also a other issue is that i need the manipulation adorner to only show resize handles in the end of the line. I can override the style for the ManipulationAdorner, but the issues is i will also have other shapes that need all four resize handles?

This is my custom tool:

    public class LineTool : DrawingToolBase
    {
        private readonly RadDiagram _diagram;

        public const string ToolName = "LineTool";

        public LineTool(RadDiagram diagram)
            : base("LineTool")
        {
            _diagram = diagram;
            Cursor = Cursors.Cross;
        }

      
        public override bool MouseDown(PointerArgs e)
        {
            if (!IsActive)
                return false;

            DrawingService.StartDraw();
            DrawingService.DrawPoints(e.TransformedPoint, e.TransformedPoint);

            return base.MouseDown(e);
        }

        public override bool MouseMove(PointerArgs e)
        {
            if (!IsActive || !ToolService.IsMouseDown || (ToolService.IsControlDown || !DrawingService.IsDrawing))
                return false;
            
            if (DrawingService.ActiveShape == null)
            {
                var shape = CreateShape();
                shape.IsSelected = true;
                shape.Geometry = new LineGeometry(e.TransformedPoint, e.TransformedPoint);

                DrawingService.InitializeDraw(shape, "PencilTool"); //LineTool does not show anything
                //SelectionService.ClearSelection();
                
                return base.MouseMove(e);
            }


            if (DrawingService.AnchorPoints.Count() > 1)
                DrawingService.RemoveLastAnchorPoint();
                
            DrawingService.DrawPoints(e.TransformedPoint, e.TransformedPoint);
            return true;
        }

        public override bool MouseUp(PointerArgs e)
        {
            if (!IsActive || !DrawingService.IsDrawing)
                return base.MouseUp(e);
            CompleteTool();
            _diagram.ActiveTool = MouseTool.PointerTool;
            return true;
        }
    }


Petar Mladenov
Telerik team
 answered on 09 Jan 2015
1 answer
247 views
Hi,

<Style x:Key="GridViewToggleButtonStyle1" TargetType="{x:Type telerik:GridViewToggleButton}">
<Setter Property="ArrowTemplate">
<Setter.Value>
<ControlTemplate TargetType="{x:Type telerik:GridViewToggleButton}">
<Border Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Border Height="9">
<Grid>
<Path x:Name="plus" Data="M0.5,0.5L6.5,3.5 0.5,6.5z" Fill="White" Height="9" Margin="{TemplateBinding Padding}" Stretch="Fill" Stroke="#FF9D9D9D" StrokeThickness="{TemplateBinding BorderThickness}" Width="6"/>
<Path x:Name="minus" Data="M6.5,0.5L6.5,6.5 0.5,6.5z" Fill="#FF595959" Height="7" Margin="{TemplateBinding Padding}" Opacity="0" Stretch="Fill" Stroke="Black" StrokeThickness="{TemplateBinding BorderThickness}" Width="7"/>
</Grid>
</Border>

<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding ElementName=LayoutRootGrid,Path=DataContext.ClickCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Border>
<ControlTemplate.Triggers>
<Trigger SourceName="plus" Property="Opacity" Value="1">
<Setter Property="Background" Value="Red"/>
</Trigger>
<Trigger SourceName="plus" Property="Opacity" Value="0">
<Setter Property="Background" Value="Yellow"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

Here is the point
<!--<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding ElementName=LayoutRootGrid,Path=DataContext.ClickCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>-->

it should work but not working

I want to execute ViewModel's ClickCommand when users expand and collapse. Take a look at the attached file
Weera
Top achievements
Rank 1
 answered on 09 Jan 2015
1 answer
232 views
Hi,
  I am facing one issue with the telerik RadDatePicker in my WPF application. I have formatted the display date with DataFormat(MM/dd/yy) so that it display two digit
year like 01/02/20.

Now when I entered 01/02/20 into the textbox(RadWatermarkTextBox) of RadDatePicker the dropdown showing 2nd Jan 2020. But when I entered 01/02/55, the dropdown is showing 2nd Jan 1955.
I am not sure why it is inconsistent when I select two differnet date. I have to validate the date entered so that user can select date with in specific range.

I can not even update the SelectedDate/DisplayDate of the DatePicker from C# code.
Could you please help me how to establish the logic to validate the date with 2 digit year.
Also let me knwo how to update the SelectedDate/DisplayDate of the radDatePicker.

Regards
Satya
Kalin
Telerik team
 answered on 09 Jan 2015
2 answers
81 views
I am using 2014.2.729.45 RadOutlookBar as a navigation tool in my wpf app.  there are 8 menu items.  I have set active items count = 5. and my selected index is bound to my view model.

If increase, via the app when running, my active items count to 8 (showing all options), and I click on ANY outlookBarItem, then the correct menu appears.

Interestingly, if I say keep the active items count to 5 and I have 3 items in the small bar across the bottom I get very strange behavior.  so my description let's say there is Item1 thru Item 8.

Item1 thru Item5 are showing
Item6 to Item8 are in the bottom bar, small icon section.

If I click on icon for Item6, the viewmodel registers Item6 clicked.
If I click on icon for Item7, the viewmodel registers Item7 clicked, and then Item6 click. - so item 6 appears
If I click on icon for Item8, the viewmodel registers Item8 clicked, and then Item7 click, then item6. - so item6 appears

so you can never get to item7 and item8 to show, unless you make all items active.


<telerik:RadOutlookBar Grid.Row="0"
                             Grid.Column="0"
                             VerticalContentAlignment="Center"
                             ActiveItemsCount="5"
                             Background="{StaticResource ColorUnityWhite}"
                             IsMinimizable="False"
                             IsVerticalResizerVisible="False"
                             MinimizedButtonContent="Menu"
                             MinimizedWidth="40"
                             SelectedIndex="{Binding CurrentMenuIndex,
                                                     Mode=TwoWay,
                                                     UpdateSourceTrigger=PropertyChanged}"
                             >

this what an Item looks like:

<!--  home  -->
            <telerik:RadOutlookBarItem Height="40"
                                      BorderBrush="{x:Null}"
                                      Header="Home"
                                      SmallIcon="/Ppdg.Unity.Client.UI;component/Assets/Images/homeVerySmall.gif"
                                      Visibility="{Binding Path=CanAccessHome,
                                                           Mode=OneWay,
                                                           Converter={StaticResource Bvc}}"
                                      >
                <telerik:RadOutlookBarItem.HeaderTemplate>
                    <DataTemplate>
                        <Grid>
                            <telerik:RadDockPanel>
                                <Image Width="32"
                                      Height="32"
                                      Source="/Ppdg.Unity.Client.UI;component/Assets/Images/homeMedium.gif"
                                      ToolTip="Home"
                                      telerik:RadDockPanel.Dock="Left"
                                      />
                                <TextBlock Margin="6 6 0 0"
                                          Style="{StaticResource MainMenuTextBlockStyle}"
                                          Text="Home"
                                          />
                            </telerik:RadDockPanel>
                        </Grid>
                    </DataTemplate>
                </telerik:RadOutlookBarItem.HeaderTemplate>
            </telerik:RadOutlookBarItem>

Robert
Top achievements
Rank 1
 answered on 08 Jan 2015
2 answers
121 views
Hello,

While trying to implement the OutlookBar as a container in Prism tutorial (http://docs.telerik.com/devtools/wpf/controls/radoutlookbar/how-to/How_to_Use_RadOutlookBar_as_a_Container_in_Prism_Application.html), the headers do not appear as the tutorial shows. 

I am following the first guide where it adds a header by adding a member, ItemHeader, to the view.  The OutlookBar is set with the DisplayProperty = "ItemHeader", but upon execution, the application does not show the header.  If the horizontal bar is dragged down, the items are minimized and can be read.  So, it appears that the header is set, but is not being displayed properly while not minimized.

I'm assuming this is a simple binding error, but I'm not sure how to proceed.
Paul
Top achievements
Rank 1
 answered on 08 Jan 2015
4 answers
139 views
Hi.

I have a custom appointment with some additional properties. When I change these properties I update appointments End time and Subject, but I see the changes only after I click on OK button. Calling OnPropertyChanged brings no effect. How can I update the UI in the edit dialog, so users can see the changes?
tarnegur
Top achievements
Rank 1
 answered on 08 Jan 2015
10 answers
197 views
I have a DocumentHost with some Panes bound to a PaneGroup. Everything works well, except when I want to Drag a Pane for Docking it, as soon as I grabbed the tab and want to drag it, an error message "System.ArgumentException was unhandled / Message: This pane cannot be removed from parent, because it doesn't have one!" appears. What is my mistake here?
Thanks for your support :)
Best regards

<!-- Tabs -->
<telerik:RadDocking.DocumentHost>
    <telerik:RadSplitContainer Margin="0,-3,0,0" BorderThickness="1">
        <telerik:RadPaneGroup TabStripPlacement="Top"
                              ItemsSource="{Binding Tabs}"
                              Background="#FFF0F0F0"
                              BorderThickness="1"
                              BorderBrush="#FF868686">
            <telerik:RadPaneGroup.ItemContainerStyle>
                <Style TargetType="telerik:RadPane">
                    <Setter Property="BorderThickness" Value="0" />
                    <Setter Property="CanUserClose" Value="False" />
                    <Setter Property="CanFloat" Value="True" />
                    <Setter Property="CanUserPin" Value="False" />
                    <Setter Property="ContextMenuTemplate" Value="{x:Null}" />
                </Style>
            </telerik:RadPaneGroup.ItemContainerStyle>
            <telerik:RadPaneGroup.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                        <StackPanel.Resources>
                            <Style TargetType="{x:Type Ellipse}">
                                <Setter Property="Width" Value="3"/>
                                <Setter Property="Height" Value="3"/>
                                <Setter Property="Fill" Value="Red"/>
                                <Setter Property="Margin" Value="3,0,3,0"/>
                            </Style>
                        </StackPanel.Resources>
                        <TextBlock Text="{Binding Title}" />
                        <Ellipse Visibility="{Binding IsDirty, Converter={StaticResource BooleanToVisibilityConverter}}" />
                        <Button Command="{Binding CloseCommand}"
                        Width="12" Height="12" Margin="4,0,0,0" ToolTipService.ToolTip="Close Tab">
                            <Button.Content>
                                <Path Data="M0,0 L6,6 M6, 0 L0,6" Stroke="Black" StrokeThickness="0.5" />
                            </Button.Content>
                        </Button>
                    </StackPanel>
                </DataTemplate>
            </telerik:RadPaneGroup.ItemTemplate>
            <telerik:RadPaneGroup.ContentTemplate>
                <DataTemplate>
                    <Views:ClientDetails
                    DataContext="{Binding}" IsDirty="{Binding IsDirty,Mode=TwoWay}" />
                </DataTemplate>
            </telerik:RadPaneGroup.ContentTemplate>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>
</telerik:RadDocking.DocumentHost>
Nasko
Telerik team
 answered on 08 Jan 2015
3 answers
582 views

Hi,

 

I cannot figure out the syntax to bind an ADO.NET DataTable to a Rad Combobox. Can you please help me by posting some source code on how to accomplish the following task:

 

 I have a DataTable fo countries that has an id column and a name column. I want to show the country name in the combo box but when an item is selected in the combo box, I want to return the id. This is a very common task in asp.net and win forms but I cannot figure out how to do this task using the rad combo box.

 

How would I accomplish something like this using the rad combo box?

 

DataTable dt = GetCountries();

This.cboCountries.DataText = “Country”;

This.cboCountries.DataValue = “id”;

This.cboCountries.DataSource = dt;

This.cboCountries.DataBind();

 

// get the selected id in the combo box

Int id = this.cboCountries.SelectedValue;

 

Can you please post the correct syntax to accomplish this task using the rad combo box.

 

Thanks for the help!

 

Bill

Kalin
Telerik team
 answered on 08 Jan 2015
4 answers
378 views
Here's what I'm trying to accomplish: I have an app that needs to show the user's current location on a map (determined using an attached GPS puck.  The library I'm using provides me the latitude, longitude and accuracy (in meters).  I will also want to place other pins on the map (lat, long only).  I want to display a dot on the map that represents the lat/long, with a circle around it, the width of which displays the accuracy of the reading.

So, I will have an observable collection of objects that have lat, long and accuracy.  I've been trying to follow this page in the documentation:

http://docs.telerik.com/devtools/wpf/controls/radmap/features/visualization-layer/data-binding.html

but this is pixel-based sizing.  I want the ellipse I draw to be a certain height/width determined by a distance on the map.  I have the radius in meters, but I also have a function that will convert it in to a value that represents the degrees of latitude/longitude, which works in the EllipseData object.  However, since I'm databinding, the EllipseData object can't be used in the items template (not a Dependency object) and even still, the properties for width and height can't be bound as they aren't dependency properties.

How can I specify a width/height of a data-bound ellipse in the information or visualization layers in meters (or degrees)?  A related question that may be the solution is this: how can I determine the scale of the currently displayed map view-port?  I could certainly use a value converter or attached property or something to figure out the pixel width from there (though I'd prefer a simpler way).

Thanks in advance!

Adam
Petar Mladenov
Telerik team
 answered on 08 Jan 2015
1 answer
175 views
I dont find missing values property for Scatterlineseries. Is it there only for HTML? My requirement is to interpolate the missing points in scatterlineseries and after interpolation is there a way to get the interpolated value.

Thanks & Regards,
Sandeep Kumar Vidiyala
Petar Marchev
Telerik team
 answered on 08 Jan 2015
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?