Telerik Forums
UI for WPF Forum
1 answer
268 views

When I change column header from longer to shorter one, the width not change

 

here is demo:

first a BindingData to transfer Header property to GridViewColumn Header property:

sealed class BindingData : Freezable
{
    protected override Freezable CreateInstanceCore()
    {
        return new BindingData { Data = this.Data };
    }
 
    public object Data
    {
        get { return (object)this.GetValue(DataProperty); }
        set { this.SetValue(DataProperty, value); }
    }
 
    public static readonly DependencyProperty DataProperty =
        DependencyProperty.Register(
            "Data",
            typeof(object),
            typeof(BindingData));
}

 

ViewModel:

sealed class ViewModel : ViewModelBase
{
    private string header = "";
    public string Header
    {
        get { return this.header; }
        set
        {
            if (this.header != value)
            {
                this.header = value;
                NotifyPropertyChanged("Header");
            }
        }
    }
 
    public IEnumerable<string> HeaderSource
    {
        get
        {
            return Enumerable.Range(1, 3)
                .Select(item => "Header " + item)
                .Concat(Enumerable.Range(3, 5)
                    .Select(item => "Very Very Very Long Header " + item));
        }
    }
 
    public IEnumerable<string> RowSource
    {
        get
        {
            return Enumerable.Range(1, 16)
                .Select(item => "Data " + item);
        }
    }
}

 

View:

<StackPanel>
    <StackPanel.Resources>
        <local:BindingData
            x:Key="HeaderBindingData"
            Data="{Binding Header}"
            />
    </StackPanel.Resources>
     
    <ComboBox
        ItemsSource="{Binding HeaderSource}"
        SelectedValue="{Binding Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
        />
     
    <telerik:RadGridView ItemsSource="{Binding RowSource}">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn
                DataMemberBinding="{Binding}"
                Header="{Binding Data, Source={StaticResource HeaderBindingData}}"
                />
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>
</StackPanel>

 

Telerik.Windows.Controls.GridView.dll version is under 2014.2

Martin Ivanov
Telerik team
 answered on 25 Feb 2019
1 answer
744 views

Hello,

I am trying to create a way to move rows up or down depending on user selection from the Context Menu.

Here are my XAML and C# code, and for some reason (still trying to figure out), the IndexOf is returning -1 =>

 

<telerik:RadGridView x:Name="gridView1" Grid.Row ="1" AutoGenerateColumns="False" Margin="0,5,0,10" FontSize="12" Deleted="OnDeletedIO" Deleting="OnDeletingIO" telerik:StyleManager.Theme="Summer" DataGridCell.GotFocus="DataGrid_CellGotFocus">
                        <telerik:RadGridView.ContextMenu>
                            <ContextMenu >
                                <MenuItem Header="MoveUp"  Click="MoveUp_click"/>
                            </ContextMenu>
                        </telerik:RadGridView.ContextMenu>
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding name}" Header="Name" IsReadOnly="False"/>
                            <telerik:GridViewComboBoxColumn x:Name="ComboGroup" DataMemberBinding="{Binding group}"  Header="Group"/>
                            <telerik:GridViewComboBoxColumn x:Name="ComboRTU" DataMemberBinding="{Binding rtu}"  Header="RTUs"/>
                            <telerik:GridViewComboBoxColumn x:Name="ComboOP" DataMemberBinding="{Binding op}"  Header="Operation"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding addr}" Header="Address"/>
                            <telerik:GridViewComboBoxColumn x:Name="ComboTypes2" DataMemberBinding="{Binding dataType}"  Header="Data Type"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding swapByte}" Header="Byte&#x0a;Swapping"
                            IsReadOnly="True">
                                
                            </telerik:GridViewDataColumn>

                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
Dinko | Tech Support Engineer
Telerik team
 answered on 25 Feb 2019
1 answer
95 views

Hi,

 

I am using RadDiagram to display a list of hexagons grouped in containers. The hexagons are displayed in the order that I add them to containers,

however the containers do not respect the order they are added when using AutoLayout.

 

Is there a way to use autolayout but still respect the order the items were added? (Top left to bottom right order).

Martin Ivanov
Telerik team
 answered on 25 Feb 2019
1 answer
146 views

The filtering menu cuts the value whenever the values are too long for the width of the menu and I can't quite figure out why. (I attached a screenshot of one of the filtering menu)

What can I do to get the filtering menu to show the entire values?

 

Thank you for your help

Martin Ivanov
Telerik team
 answered on 25 Feb 2019
1 answer
113 views

My RadPolarChart represents an antenna radiation pattern. I need to draw an annotation relative to the origin. How can I do this? My radial axis is NumericRadialAxis but I cannot seem to figure out the origin value, and PolarCustomAnnotation wants polar and radial coordinates.

The attached image represents an antenna mounting image. i want to center the small ellipse around the origin. I'm using a DrawingImage in XAML to define the geometry.

Thanks.

-John.

 

 

 

Reilly
Top achievements
Rank 1
Veteran
 answered on 22 Feb 2019
5 answers
160 views

Hi!

 

I am using RadDiagram where we have custom controls that show up on the mouse hover of some shapes.

When we zoom and create these custom controls, the zoom affects our custom controls as well (which has buttons and text, making them unusable)

 

I've tried to use the layouttransform to my control:

LayoutTransform="{Binding ElementName=Shape, Path=LayoutTransform.Inverse}"/>

 

But it didn't work. Any ideas?

Dinko | Tech Support Engineer
Telerik team
 answered on 22 Feb 2019
1 answer
195 views
Hello,
our company uses your controls in your project.
We have the following question:
Could Component Spreadsheet be fed with data from a xml file or a stream of data from xml file?
Tanya
Telerik team
 answered on 22 Feb 2019
1 answer
130 views

Dear support,

how can I implement date-dependencies in GanttView. That means

1. task2 depends on task1 (defined in "Dependencies")

2. if end-date of task1 changes for example from 31st of January to the 28th of February also the begin-date from task2 "automatically" has to change from 31st to 28th



Thanks in advance

Marcus

Vladimir Stoyanov
Telerik team
 answered on 22 Feb 2019
7 answers
1.9K+ views
Hello,

I'd like to add a button to the left of Minimize Button of the RadWindow for WPF. I want to create a custom control based on RadWindow. I'm not very familiar with creating custom controls. I got the control template of the RadWindow by using Blend, but I don't want to redo the whole template; I want to be able to use the RadWindow as it comes and just add that button to the title bar. What is the best way to do so?

Thanks,
LauraH
Dinko | Tech Support Engineer
Telerik team
 answered on 22 Feb 2019
2 answers
341 views

I have an RadAutoCompleteBox with a dynamic ItemSource that works some places and not others.  In the setter for the SearchText I run a search and populate the ItemSource.  In the box I'm working on now, the ItemSource's ObservableCollection is giving me "Exception thrown: 'System.ArgumentException' in System.Core.dll" when i try and add item to it. This method works many places elsewhere, and If i manually set the SearchText elsewhere the offending code runs without error. Any help would be greatly appreciated.

Here's the XAML:

<telerik:RadAutoCompleteBox 

    Grid.Column="2" Grid.Row="3"
    x:Name="AutoCompleteBoxMakeModel"
    ItemsSource="{Binding MakeModelCollection}"
    SearchText="{Binding MakeModelTerm, Mode=TwoWay}"
    SelectedItem="{Binding SelectedMakeModel, Mode=TwoWay}"
    SelectionMode="Single"
    HorizontalAlignment="Left" 
    TextSearchPath="Display"
    TextSearchMode="Contains"
    AutoCompleteMode="Suggest"
    IsDropDownOpen="{Binding IsMakeModelDropDownOpen, Mode=TwoWay}"
    DropDownItemTemplate="{StaticResource MakeModelSearchTemplate}"
    DropDownWidth="300"
    VerticalAlignment="Top" Width="275"  Height="25" Margin="0,3,0,0" >
    <telerik:StyleManager.Theme>
        <telerik:VisualStudio2013Theme/>
    </telerik:StyleManager.Theme>
</telerik:RadAutoCompleteBox>

 

And here's the offending code:

private string makeModelTerm;
public string MakeModelTerm
{
    get { return makeModelTerm; }
    set
    {
        if (makeModelTerm == value)
        {
            return;
        }
        makeModelTerm = value;
        RaisePropertyChanged("MakeModelTerm");
        if (value.Length > 2)
        {
            SearchMakeModel(value);
        }
    }
}

private void SearchMakeModel(string value)
{
    LookUpRepository er = new LookUpRepository();
    var list = er.SearchMakeModel(value);
    MakeModelCollection.Clear();
    list.ForEach(MakeModelCollection.Add); // This triggers the System.ArgumentException on each value in list
    this.IsMakeModelDropDownOpen = true;
}

Gordon
Top achievements
Rank 1
 answered on 21 Feb 2019
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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?