Telerik Forums
UI for WPF Forum
3 answers
364 views
hi,
following setup: a radpane with a user control with a grid that has two rows (row 1 is height auto, row 2 is height *), the second row contains a radgridview. the gridview holds four columns gridviewdatacolumn, nothing fancy. i'm assigning an observablecollection to the itemssource in the usercontrol.loaded event handler.

for some reason the column widths are not set when starting the software. instead they are as it looks like set to the minimum width. it worked before and i can't remember doing anything to this part of the application.

i have to resize the pane or a column a bit or re-assign the observablecollection to the itemssource and then the correct widths are applied. tried with ColumnWidth="*" and with Width="*" on the GridViewDataColumn entries. also setting AutoGenerateColumns to true shows the same result. setting ColumnWidth="Auto" at least shows the full content for each row but looks ugly because it leaves too much whitespace.

i also replaced the whole usercontrol with a backup i made yesterday but same result. works in the backup, not in the current version. replaced also the other controls with old code and it's still not working. 

any clue what could cause this behaviour or at least how i can force the gridview to recalculate the column sizes once the control is displayed?

        
<telerik:RadGridView Grid.Row="1" ColumnWidth="*" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ShowGroupPanel="False" AutoGenerateColumns="False" CanUserInsertRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" ShowColumnHeaders="True" CanUserSortColumns="False" RowIndicatorVisibility="Collapsed">
 
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Title, Mode=OneWay}"   IsReadOnly="True" Header="Chord" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding DisplayNotes, Mode=OneWay}"  IsReadOnly="True" Header="Notes" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding NumNotes, Mode=OneWay}"   IsReadOnly="True" Header="Notes"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding PlayKey, Mode=OneWay}"   IsReadOnly="True" Header="Play"/>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>
Ivan Ivanov
Telerik team
 answered on 09 Jan 2015
27 answers
1.1K+ views
Hi!

I've actually a radGridView and a RadDataPager.

The source of the RadDataPager.Source is bound to the radGridView.items.

It was working fine, but I found a problem: Sometimes I have to switch between tabs and select a specified object.

I'm using the RadGridView.SelectedItem =TheNewItem.

But if the new item is on another page, it just doesn't select anything. So how can I do that?

thank you!
Lawrence
Top achievements
Rank 2
Iron
 answered on 09 Jan 2015
5 answers
182 views
If I have a cell with string values
"value1" "value2" "value3"

In my custom filter, how do I get these values?

I have made this custom one, but I have hard coded the values

CustomItems = new ObservableCollection<CheckBoxCustomFilterType>
{
    new CheckBoxCustomFilterType { Checked = false, Text = "5016" },
    new CheckBoxCustomFilterType { Checked = true, Text = "25835" }
};


I need to get them instead and create a list, how would I retrieve those values? I cant seem to find an example, the date one is not applicably here

<UserControl
    x:Class="Systematic.KVK.InseminationPlan.UIL.Details.Windows.SemenBucket.CustomFilters.CheckBoxFilterControl"
    xmlns:localization="clr-namespace:Systematic.KVK.InseminationPlan.Localization"
    xmlns:customFilters="clr-namespace:Systematic.KVK.InseminationPlan.UIL.Details.Windows.SemenBucket.CustomFilters"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Systematic.KVK.WPFCommon;component/Style/ModernStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
 
    <Border x:Name="LayoutRoot" BorderThickness="1" BorderBrush="{StaticResource DarkGreenHoverColor}" Padding="5"
            Background="{StaticResource White}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120" />
                <ColumnDefinition Width="120" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
 
            <CheckBox Margin="3, 0, 0, 8" Content="{x:StaticExtension localization:SemenBucketTexts.SelectAll}" Click="SelectAll" />
 
            <telerik:RadGridView
                Name="CheckBoxGridView"
                Grid.Column="0"
                Grid.ColumnSpan="2"
                Grid.Row="1"
                AutoGenerateColumns="False"
                CanUserDeleteRows="False"
                CanUserSelect="False"
                ShowColumnHeaders="False"
                CanUserReorderColumns="False"
                BorderThickness="0"
                HorizontalAlignment="Left"
                ItemsSource="{Binding CustomItems}">
                <telerik:RadGridView.Columns>
 
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=IsSelected}" Header=""
                                            EditTriggers="CellClick" IsReadOnly="True">
                        <telerik:GridViewDataColumn.HeaderCellStyle>
                            <Style TargetType="{x:Type telerik:GridViewHeaderCell}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <CheckBox Margin="3, 0, 0, 8"
                                                Command="{Binding Path=DataContext.SelectedAllCommand, ElementName=ListTabViewName}"
                                                IsChecked="{Binding Path=DataContext.ShouldAllBeChecked, ElementName=ListTabViewName}"
                                                HorizontalAlignment="Left" VerticalAlignment="Center" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </telerik:GridViewDataColumn.HeaderCellStyle>
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding Path=Checked, Mode=TwoWay}"
                                          Content="{Binding Path=Text}"
                                          HorizontalAlignment="Left" VerticalAlignment="Center" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </telerik:GridViewDataColumn>
 
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
 
            <Button Grid.Column="0" Grid.Row="2" Name="FilterButton"
                    Content="{x:StaticExtension localization:SemenBucketTexts.Filter}" Click="OnFilter" Margin="9" />
            <Button Grid.Column="1" Grid.Row="2" Name="ClearButton"
                    Content="{x:StaticExtension localization:SemenBucketTexts.Clear}" Click="OnClear" Margin="9" />
        </Grid>
    </Border>
</UserControl>
Codebehind
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Data;
 
namespace Systematic.KVK.InseminationPlan.UIL.Details.Windows.SemenBucket.CustomFilters
{
    /// <summary>
    /// Interaction logic for CheckBoxFilterControl.xaml
    /// </summary>
    public partial class CheckBoxFilterControl : IFilteringControl
    {
        public ObservableCollection<CheckBoxCustomFilterType> CustomItems { get; set; }
        private GridViewBoundColumnBase column;
        private CompositeFilterDescriptor compositeFilter;
 
        public CheckBoxFilterControl()
        {
            InitializeComponent();
 
            CustomItems = new ObservableCollection<CheckBoxCustomFilterType>
            {
                new CheckBoxCustomFilterType { Checked = false, Text = "5016" },
                new CheckBoxCustomFilterType { Checked = true, Text = "25835" }
            };
             
            DataContext = this;
        }
 
        private void OnFilter(object sender, RoutedEventArgs e)
        {
            column.DataControl.FilterDescriptors.Clear();
 
            compositeFilter = new CompositeFilterDescriptor();
            compositeFilter.LogicalOperator = FilterCompositionLogicalOperator.Or;
            string dataMember = column.DataMemberBinding.Path.Path;
            foreach (var checkBoxCustomFilterType in CustomItems)
            {
                if (checkBoxCustomFilterType.Checked)
                {
                    var filter = new FilterDescriptor(dataMember, FilterOperator.IsEqualTo, checkBoxCustomFilterType.Text);
                    compositeFilter.FilterDescriptors.Add(filter);
                }
            }
 
            if (!column.DataControl.FilterDescriptors.Contains(compositeFilter))
            {
                column.DataControl.FilterDescriptors.Add(compositeFilter);
            }
 
            IsActive = true;
        }
 
        private void OnClear(object sender, RoutedEventArgs e)
        {
            column.DataControl.FilterDescriptors.Reset();
 
            IsActive = false;
        }
 
 
        public void Prepare(Telerik.Windows.Controls.GridViewColumn column)
        {
            this.column = column as GridViewBoundColumnBase;
            if (this.column == null)
            {
                return;
            }
        }
 
        public bool IsActive { get; set; }
 
        private void SelectAll(object sender, RoutedEventArgs e)
        {
            var checkbox = (sender as CheckBox);
            if (checkbox == null || checkbox.IsChecked == null)
            {
                return;
            }
 
            foreach (var checkBoxCustomFilterType in CustomItems)
            {
                checkBoxCustomFilterType.Checked = checkbox.IsChecked.Value;
            }
        }
    }
}
Dimitrina
Telerik team
 answered on 09 Jan 2015
2 answers
141 views
Hello everyone,
I'm working with radAutoCompleteBox.
Is there a way to select an item from Javascript?

Thank You
Aneliya Petkova
Telerik team
 answered on 09 Jan 2015
1 answer
256 views
Hi all,

I updated to the latest version of Telerik's UI for WPF, from version 2013.1.403.40 to 2014.3.1305.40.

In our application we have RadListbox which is bound to a list of items. The datatemplate used holds 2 usercontrols and a button.
The usercontrol in itself has a numericupdown and maskedtextbox. So when all items are rendered there are five controls per listbox item/line.

Now in the past when the user selected one of the controls inside the datatemplate and then tabbed away, all controls in all the items would be cycled over, this is how the user wants to use it. Now with the new version this behavior is not present anymore, when the user selects for example the first maskedtextbox of the first item and tabs, the focus is moved to other fields outside of the listbox and when cycling further, the listbox its items (controls inside it) are never tabbed over again... When I just change the version of the Telerik dll's back to the old ones, I get the behaviour expected.

I've setup a small POC showing that this happens with the RadListBox but not with an ItemsControl.

Any help is appreciated, thnx in advance!

See http://1drv.ms/141ezct for the files.

Dwight
Kalin
Telerik team
 answered on 09 Jan 2015
9 answers
420 views
Hello,
I've a RadMaskedNumericInput with the mask  Mask="#9.4", I want to show _____.__ when the page loads up (null value binded) but I got ____0.00 why?

Thanks
Ankur
Top achievements
Rank 1
 answered on 09 Jan 2015
3 answers
332 views
Why does Telerik default back to the Microsoft.Win32 open file dialog rather than creating their own?
Petya
Telerik team
 answered on 09 Jan 2015
1 answer
225 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
281 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
274 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
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?