Telerik Forums
UI for WPF Forum
2 answers
264 views
There are times when I would need to cancel the Current Item Changed event. This is based on un-saved data for exmaple. So, when the user clicks on the right/left arrows (for navigation), the Data Form instantly changes the Current Item and then fires the event.

Well, if conditions determine that the user should not move forward/backward, how do I go back to the previous Current Item?

Example: Data Form has three values (1, 2, 3). Current Item is 2. User clicks right nav. arrow and Data Form takes the user to Item 3. based on a condition (true/false) I need the Data Form to stay on item 2 (or go back to item 2)

Any ideas would be appreciated.

Thanks, M
Marcelo
Top achievements
Rank 1
 answered on 14 Nov 2011
2 answers
94 views
Hello,

In a ScheduleView, I need to hide some days of each week (for example wednesdays and fridays). I look at the grouping and filtering functionalities, but I'm not sure it can help me with my need.

Is it possible to do this on a ScheduleView (only in WeekView) ? If yes, can you tell me how ?

Thank you in advance

Pauline
Pauline
Top achievements
Rank 1
 answered on 14 Nov 2011
8 answers
393 views
I would like to hide some rows in a GridView, however setting the Row's visibility to Collapsed still leaves a blank space where the row should be.

The trigger I am using to hide both GridViewGroupRows and GridViewRows looks like this:

<Style TargetType="{x:Type telerik:GridViewGroupRow}">
    <Setter Property="Visibility" Value="Visible" />
    <Style.Triggers>
        <DataTrigger Binding="{Binding Group.Key, RelativeSource={RelativeSource Self}}" Value="SomeValue">
            <Setter Property="Visibility" Value="Collapsed" />
        </DataTrigger>
    </Style.Triggers>
</Style>


I do not want to filter results because I need them for aggregate results in the groups and the footer. So how can I hide specific GridViewRows without filtering the data?
LHR
Top achievements
Rank 1
 answered on 14 Nov 2011
1 answer
179 views
Hi i have correct make a Context menù and binded it some example, 
after i have bind DelegateCommand some MyCommand,
And the Context menù is ok, but i whant pass to ContextMenù from the treeview Datacontext ,
the data, for call the right item when i click on the RadMenuItem, and take for example treeitemDatacontext.GuidId

In the telerik example use CommandParameter="{Binding Menu.ClickedListBoxItem, RelativeSource={RelativeSource Self}}"
but i dont undestand the Menu.ClickedListBoxItem item .

i have try, but not work, please help me 

regard 
<UserControl x:Class="Sicant.Modules.PSCDocument.Controls.TreeView"
                         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                         xmlns:example="clr-namespace:Sicant.Modules.PSCDocument"
                         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                         xmlns:tlkn="http://schemas.telerik.com/2008/xaml/presentation"
                         xmlns:Commands="clr-namespace:Sicant.Global.Commands;assembly=Sicant.Global" d:DesignHeight="600"
                         d:DesignWidth="300"
                         mc:Ignorable="d">
    <UserControl.Resources>
        <Style x:Key="SquareButton" TargetType="{x:Type Button}">
            <Setter Property="Button.Height" Value="25" />
            <Setter Property="Button.Width" Value="25" />
            <Setter Property="Margin" Value="2,2,2,2" />
        </Style>
        <Style x:Key="Menu" TargetType="Grid">
            <Setter Property="Height" Value="25" />
            <Setter Property="Width" Value="300" />
            <Setter Property="Background" Value="{StaticResource DarkBrush}" />
        </Style>
        <!--  nuovo per menù contestuale  -->
        <DataTemplate x:Key="Risorsa1_Template">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/Document.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="Risorsa2_Template">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/Mail_Closed.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </DataTemplate>
        <HierarchicalDataTemplate x:Key="Account_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/male.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="Container_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/Metal_Crate.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="PSC_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/PSC.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="Allegati_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/Download.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="Add_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/add-tab.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <example:MyTemplateSelector x:Key="myTemplateSelector"
                                                                Template1="{StaticResource Risorsa1_Template}"
                                                                Template2="{StaticResource Risorsa2_Template}"
                                                                AccountTemplate="{StaticResource Account_HierTemplate}"
                                                                ContainerTemplate="{StaticResource Container_HierTemplate}"
                                                                PSCTemplate="{StaticResource PSC_HierTemplate}"
                                                                AllegatiTemplate="{StaticResource Allegati_HierTemplate}"
                                                                AddTemplate="{StaticResource Add_HierTemplate}"
                                                                />
        <DataTemplate x:Key="contextMenuItemTemplate">
            <tlkn:RadMenuItem Grid.Column="2"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Center"
                                        Command="{Binding MyCommand}"
                                        CommandParameter="{
                                        Binding #What is the correct binding?#,
                                        RelativeSource={RelativeSource Self}
                                        }"
                                        Header="{Binding Header}"></tlkn:RadMenuItem>
 
        </DataTemplate>
        <Style x:Key="contextMenuItemStyle" TargetType="tlkn:RadMenuItem">
            <Setter Property="Width" Value="200" />
            <Setter Property="Height" Value="30" />
            <Setter Property="Icon" Value="{Binding Icon}" />
            <Setter Property="IsSeparator" Value="{Binding IsSeparator}" />
 
        </Style>
        <Style x:Key="treeViewStyle" TargetType="tlkn:RadTreeViewItem">
            <Setter Property="IsExpanded" Value="True" />
        </Style>
    </UserControl.Resources>
 
    <Grid>
        <DockPanel Name="dockTreePanel1" LastChildFill="True">
            <ContentControl Name="TopTreePanel"
                                            Height="AUTO"
                                            DockPanel.Dock="Top" />
            <ContentControl Name="MainTreePanel" DockPanel.Dock="Top" />
            <!--  contenitore di treeview complete  -->
            <StackPanel x:Name="Contenitore"
                                    Width="300"
                                    Margin="0"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top"
                                    Orientation="Vertical">
                <!--  contenitore di treeview Archivi completa  -->
                <StackPanel x:Name="Contenitore_Archivi"
                                        Width="300"
                                        Margin="0"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Top"
                                        Orientation="Vertical">
                    <!--  contenitore di Titolo Archivi  -->
                    <Grid HorizontalAlignment="Left" Style="{StaticResource Menu}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="28" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="48" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Image Grid.Column="0"
                                     Width="16"
                                     Height="16"
                                     Margin="0"
                                     VerticalAlignment="Center"
                                     Source="{StaticResource ArchiveImg}" />
                        <TextBlock Grid.Column="1"
                                             Margin="15,0,0,0"
                                             HorizontalAlignment="Left"
                                             VerticalAlignment="Center"
                                             Text="Documento PSC" />
                        <Button Grid.Column="2"
                                        Width="20"
                                        Height="20"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Center"
                                        Style="{StaticResource SquareButton}"
                                        ToolTip="Copia nell'archivio utente"
                                        Command="{x:Static Commands:PSCCommand.CmdPSC_PrintAll}">
                            <Image Width="14"
                                         Height="14"
                                         Source="{StaticResource PrintImg}" />
                        </Button>
                    </Grid>
                    <tlkn:RadTreeView x:Name="radTreeView"
                                                        ItemContainerStyle="{StaticResource treeViewStyle}"
                                                        ItemTemplateSelector="{StaticResource myTemplateSelector}">
                        <tlkn:RadContextMenu.ContextMenu>
                            <tlkn:RadContextMenu x:Name="radContextMenu"
                                                                     ItemContainerStyle="{StaticResource contextMenuItemStyle}"
                                                                     ItemTemplate="{StaticResource contextMenuItemTemplate}"
                                                                     Opened="RadContextMenu_Opened" />
                        </tlkn:RadContextMenu.ContextMenu>
                    </tlkn:RadTreeView>
                </StackPanel>
            </StackPanel>
        </DockPanel>
    </Grid>
</UserControl>

Yana
Telerik team
 answered on 14 Nov 2011
0 answers
72 views
Hi,

here is the XAML of my radGridView
<telerikGridView:RadGridView Name="grdScope"  ScrollMode="RealTime"   DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CanUserInsertRows="False"  AutoGenerateColumns="False" CanUserSortColumns="False" CanUserFreezeColumns="False" CanUserReorderColumns="False" IsFilteringAllowed="False" CanUserResizeColumns="True" Telerik:StyleManager.Theme="Office_Blue" RowStyle="{StaticResource GridViewRowStyleRow}" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionMode="Single" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding}" RowDetailsVisibilityMode="Collapsed" RowIndicatorVisibility="Collapsed" IsReadOnly="True" ShowGroupPanel="False"  AutoExpandGroups="True" RowLoaded="grdScope_RowLoaded" SelectionUnit="FullRow" SelectionChanged="grdScope_SelectionChanged"
 MouseDoubleClick="grdScope_MouseDoubleClick" DataLoadMode="Asynchronous" EnableColumnVirtualization="True" EnableRowVirtualization="False">


I am trying to set selected row programatically like this-

var item = ((IList<Task>) this.grdScope.ItemsSource)[this.SelectedTaskIndex];
this.grdScope.SelectedItem = item;

even when variable item has a non-null value, radGridView's SelectedItem property never changes from null to anything else when this code runs.
Am I doing something wrong?
Arpit
Top achievements
Rank 1
 asked on 14 Nov 2011
0 answers
130 views
Hello,

I am stuck with a small problem like when user Collapse a parent node then i need all the child node of the parent node be expanded too. Suppose I have 6 level of nodes and user click on 3 rd level node to collapse. Then all the child nodes of that 3 rd level will be collpased. But the other nodes will remain unchangd state. The ExpandAll/CollpaseAll will not work since that will expand or collapse all the nodes of TreeListView. Please help me asap.

Thanks

Manishkumar
Top achievements
Rank 1
 asked on 14 Nov 2011
6 answers
710 views
new to teleirk controls and tried searching elsewhere.

I have a radchart on a wpf app. the data series are dynamically given to the xaml file to display. it can chart 1 to 4 lines at a time. We want to create some toggles on the screen that will turn on/off viislibty PEr line and on/off data labels per line. 

i did some research on how to programmatically set binding and it only partially works. my converter fires from the toggle, but the dependency property does not. here are the key pieces of code:

codebehind:

Format Code Block
             var seriesMapping = new SeriesMapping();

            var seriesDefinition = new LineSeriesDefinition();

            seriesMapping.SeriesDefinition = seriesDefinition;

  var binding = new Binding(){ Path= new PropertyPath("IsChecked"), Converter = new BooleanToVisibilityConverter(), Source = toggleVisible1, Mode = BindingMode.OneWay};

                    BindingOperations.SetBinding(seriesDefinition, SeriesDefinition.VisibilityProperty, binding);
Format Code Block


XAML
<CheckBox x:Name="toggleVisible1" Content="Show Line"  HorizontalAlignment="Right" Margin="5,2,15,2" FlowDirection="RightToLeft" IsChecked="True"  />

converter code - for the most part boils down to this:
 return (value? Visibility.Visible : Visibility.Collapsed);


Again, the converter fires when the checkbox is toggle, but the series always stays visible. what am i doing wrong?
i am using latest version of wpf controls.

 

Evgenia
Telerik team
 answered on 14 Nov 2011
1 answer
237 views
Hello,

I want to implement a custom copy and paste function for all my GridViews.
Therefore I registered an application wide command binding for all RadGridView types.

var copyBinding = new CommandBinding(RadGridViewCommands.Copy, ExecuteGridViewCopyCommand,
                                                 CanExecuteGridViewCopyCommand);
CommandManager.RegisterClassCommandBinding(typeof(RadGridView), copyBinding);

However, the handlers are not executed.

Even if I do the binding directly on a GridView:

var copyBinding = new CommandBinding(RadGridViewCommands.Copy, ExecuteGridViewCopyCommand,
                                                 CanExecuteGridViewCopyCommand);
gridViewCategories.CommandBindings.Add(copyBinding);

What I am doing wrong?

Best regards,

Franziska
Maya
Telerik team
 answered on 14 Nov 2011
2 answers
187 views
I'm trying to update a polygon-point location using a Map.MouseMove handler but the shape on the map is displayed incorrectly, as if the polygon bounds are not updated.  If I position the updated point within the bounds of the existing polygon, all the points are rendered correctly.  Changing the zoom level also corrects the problem, until the mouse is moved enough again.

I've attached screenshots:

RadMapPolygonA.png shows the initial, correct state, with the red dot showing the MouseMove position which is supposed to update the location of the point beneath it.

RadMapPolygonB.png shows what happens if you update the location property of the polygon point outside the bounds of the existing polygon.  

RadMapPolygonC.png shows the correctly rendered polygon after I changed the zoom level and reset it.

void RadMapMouseMove(object sender, MouseEventArgs e)
{
    if (!vm.DrawingShape || vm.CurrentShape == null) return;
    if (vm.CurrentShape.LocationWrappers.Count < 2) return;
    var locationWrapper = vm.CurrentShape.LocationWrappers[vm.CurrentShape.LocationWrappers.Count - 1];
    var location = Location.GetCoordinates(RadMap, e.GetPosition(RadMap));
    locationWrapper.Location = location;  // updates databound LocationCollection
}

Andrey
Telerik team
 answered on 14 Nov 2011
4 answers
342 views
Hello,

I want to show Plus/Minus (+/-) in Expander button style in my TreeListView node.
I want the TreeListView default  Office Blue style to remain as it is, just need to change the Expander style only. 

I have tried many but unable to accomplish. Please suggest me a solution asap. Please find the screenshot
Manishkumar
Top achievements
Rank 1
 answered on 14 Nov 2011
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?