Telerik Forums
UI for WPF Forum
1 answer
970 views
Hi there!

Is there are feature which autosizes a combobox due to its content?
I guess I found something for the dropdown-width, but it would be nice to have something similar for the box itself.

Best Regards,
Matthias
Pana
Telerik team
 answered on 13 Jul 2011
1 answer
230 views
Hi All,
I am working on the Wpf 4.0 and using MVVM and Prism in my application.
I have added the Today button inside the control template for the RadTimePicker which is defined inside a resource dictionary.
Following is the code snippets for it (Bold and Italics part I have added to the control template of the RadDateTimePickerControlTemplate ):

 

 

 

 

<telerik:RadDropDownButton x:Name="PART_DropDownButton" CloseOnEnter="True" Grid.Column="1" DropDownIndicatorVisibility="Collapsed" Focusable="False" telerik:DateTimePickerExtensions.FocusContentOnOpen="True" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsTabStop="False" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="-1,0,0,0" Padding="0" PopupPlacementTarget="{Binding ElementName=PART_DateTimeInput}" TabIndex="1" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch"><telerik:RadDropDownButton.DropDownContent>

 

 

 

<Grid>

 

 

 

 

<Grid.ColumnDefinitions>

 

 

 

 

<ColumnDefinition Width="*"/>

 

 

 

 

<ColumnDefinition Width="*"/>

 

 

 

 

</Grid.ColumnDefinitions>

 

 

 

 

<Grid.RowDefinitions>

 

 

 

 

<RowDefinition/>

 

 

 

 

<RowDefinition/>

 

 

 

 

<RowDefinition Height="33"/>

 

 

 

 

</Grid.RowDefinitions>

 

 

 

 

<telerik:RadCalendar x:Name="PART_Calendar"

 

 

 

Culture="{TemplateBinding Culture}"

 

 

 

Grid.Column="0"

 

 

 

DisplayDateEnd="{Binding DisplayDateEnd, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" DateSelectionMode="{TemplateBinding DateSelectionMode}"

 

 

 

DisplayDateStart="{Binding DisplayDateStart, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" DisplayDate="{Binding DisplayDate, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"

 

 

 

IsReadOnly="{TemplateBinding IsReadOnly}"

 

 

 

Grid.Row="0"

 

 

 

Style="{TemplateBinding CalendarStyle}"

 

 

 

SelectableDateEnd="{Binding SelectableDateEnd, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"

 

 

 

SelectionMode="Single"

 

 

 

SelectedDate="{Binding SelectedDate, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"

 

 

 

SelectableDateStart="{Binding SelectableDateStart, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">

 

 

 

 

</telerik:RadCalendar>

 

 

 

 

<telerik:DateTimePickerClock x:Name="PART_Clock" Culture="{TemplateBinding Culture}" Grid.Column="1" EndTime="{TemplateBinding EndTime}" Header="Clock" IsReadOnly="{TemplateBinding IsReadOnly}" Grid.Row="0" Style="{TemplateBinding ClockStyle}" SelectedTime="{Binding SelectedTime, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" StartTime="{TemplateBinding StartTime}" TimeInterval="{Binding TimeInterval, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">

 

 

 

 

</telerik:DateTimePickerClock>

 

 

 

 

<StackPanel Grid.Row="2" Background="#ABACA7" >

 

 

 

 

<Border BorderThickness="1" Grid.Row="2" VerticalAlignment="Top" BorderBrush="whitesmoke" Margin="1" >

 

 

 

 

<Button Style="{StaticResource DatePickerButton}" Content="Today" />

 

 

 

 

</Border>

 

 

 

 

</StackPanel>

 

 

 

 

<!--Date Picker Button Style -->

 

 

 

 

 

 

 

 

<Style x:Key="DatePickerButton" TargetType="Button">

 

 

 

 

 

 

 

 

<Setter Property="Background" Value="#E0E0DE" />

 

 

 

 

 

 

 

 

<Setter Property="BorderBrush" Value="#91918F"/>

 

 

 

 

 

 

 

 

<Setter Property="VerticalAlignment" Value="Center"/>

 

 

 

 

 

 

 

 

<Setter Property="BorderThickness" Value="1"/>

 

 

 

 

 

 

 

 

<Setter Property = "HorizontalAlignment" Value="Center"/>

 

 

 

 

 

 

 

 

<Setter Property="Height" Value="24"/>

 

 

 

 

 

 

 

 

<Setter Property="Width" Value="50"/>

 

 

 

 

 

 

 

 

<Setter Property="FontSize" Value="11"/>

 

 

 

 

 

 

 

 

<Setter Property="FontWeight" Value="ExtraBold"/>

 

 

 

 

 

 

 

 

<Setter Property= "Margin" Value="2"/>

 

 

 

 

 

 

 

 

<Setter Property= "Cursor" Value="Hand"/>

 

 

 

 

 

 

 

 

<Setter Property="Template">

 

 

 

 

 

 

 

 

<Setter.Value>

 

 

 

 

 

 

 

 

<ControlTemplate TargetType="Button">

 

 

 

 

 

 

 

 

<Border BorderThickness="{TemplateBinding BorderThickness}"

 

 

 

 

 

 

 

BorderBrush="{TemplateBinding BorderBrush}"

 

 

 

 

 

 

 

Background="{TemplateBinding Background}"

 

 

 

 

 

 

 

Padding="{TemplateBinding Padding}"

 

 

 

CornerRadius="2.8"

 

 

 

>

 

 

 

 

 

 

 

 

<ContentControl Content="{TemplateBinding Content}"

 

 

 

HorizontalAlignment="Center"

 

 

 

VerticalAlignment="Center"/>

 

 

 

 

 

 

 

 

</Border>

 

 

 

 

 

 

 

 

</ControlTemplate>

 

 

 

 

 

 

 

 

</Setter.Value>

 

 

 

 

 

 

 

 

</Setter>

 

 

 

 

 

 

 

 

<Style.Triggers>

 

 

 

 

 

 

 

 

<Trigger Property="IsMouseOver" Value="true">

 

 

 

 

 

 

 

 

<Setter Property="Background" Value="{StaticResource SecondaryMouseOverColor}"/>

 

 

 

 

 

 

 

 

<Setter Property="BorderBrush" Value="Gold"/>

 

 

 

 

 

 

 

 

</Trigger>

 

 

 

 

 

 

 

 

<Trigger Property="IsPressed" Value="true">

 

 

 

 

 

 

 

 

<Setter Property="Background" Value="{StaticResource SecondaryMouseOverColor}"/>

 

 

 

 

 

 

 

 

<Setter Property="BorderBrush" Value="Orange"/>

 

 

 

 

 

 

 

 

</Trigger>

 

 

 

 

 

 

 

 

</Style.Triggers>

 

 

 

 

 

 

 

 

</Style>

 

 

 

 


Now in our application we have created a custom control for RadTimePicker , and I need to apply a trigger on today button that on clickof this "Today" button i should get today's date selected in the calendar.

So can I write any trigger in my style to do so ???? or how can we do this in present scenerio ???

Thanks in advance !!!!
Pana
Telerik team
 answered on 13 Jul 2011
1 answer
112 views
I notice that when there is no more space for the last pane in the RadPaneGroup, the pane is truncated. I prefer it not to be shown at all but still appears in the drop down menu navigation. How do I achieve this?
Pana
Telerik team
 answered on 13 Jul 2011
1 answer
168 views
Hi,

Is it possible to apply a ValueConverter to the selected item in an editable ComboBox?

I have successfully applied a ValueConverter to the items in the ComboBox itself (through creating a custom DataTemplate and assigning it to the ItemTemplate property of the ComboBox), but this ValueConverter is not applied to the currently selected item.

I have tried to open the ComboBox in Expression Blend and creating a custom ControlTemplate for it (and assigning this template to the EditableTemplate property). However I could not find a way to apply the converter to the PART_EditableTextbox in the generated template.

Thanks,
Kristian
Pana
Telerik team
 answered on 13 Jul 2011
1 answer
308 views
I have a proof-of-concept WPF app with parent RadGridView with two hierarchical levels of child details.   Most of the information on the child detail of the top-level parent is in a child RadGridView.   That child grid's row details are mainly another RadGridView of the first child's children.    In the POC, all three grids were bound directly to VS2010-generated DataAdapters/Views.  That worked fine as long as only one top-level parent at a time had to display row details.

Now I find I need to instead have row details displayed at the same time for multiple parent rows in a RadGridView.   But if I simply source the child details out of the existing child dataset, then all parent table rows will show the child details for the same, currently selected parent row instead of being the unique child details which match each parent row.

I'd like to know what you recommend as the best practice for providing binding sources for child table-sourced row details to support multiple, simultaneous child row details displays.

I had thought about creating separate observable collections in the LoadingRowDetails event of the top two grids.  But with the parent grids' rows directly bound to DataAdapters/DataViews, there is no way to separate the data contexts with multiple top-level parent row details simultaneously opened.

I realize could do this by hand-creating three levels of custom business objects and sourcing their content from the database rows.   But I'd rather not start over like that if there is a decent solution leveraging at least part of the existing direct database data objects.  (All the current code for updating the database is directly using the bound DataSet/DataAdapter objects to automatically track the change deltas and perform the database updates).

What is the best practice here for providing multi-level row-details?   Should I just bite the bullet and change the app over to working off of three-level, hierarchical custom business objects, tracking my own change deltas, and hand-coding the database update logic?

Thanks for your thoughts,
-Bob
BRiddle
Top achievements
Rank 1
 answered on 12 Jul 2011
6 answers
315 views
I have a collection of class "Person" containing
  • Name (string)
  • ID (int)
  • ParentID (int)

and that linear list defines a hierarchy by referencing to itself (each person whoose ID (primary key) is equal to the ParentID (foreign key) of another person is parent of this other person.
In the telerik WPF Controls Examples showing the Self-Reference Hierarchy, the thing is, that this hierarchy is not a clean hierarchy tree, because elements of the first level (e.g. EmployeeID = 1) show up in the second level as well. I would need to build a tree like a family tree, where one Id can only occur in one place and nowhere else. One the other hand, it would be nice to have the tree in linear form as well, to see all persons at one glance.
Can someone give me a hint, how this can be done easily?
Thanks,
hermann
Top achievements
Rank 1
 answered on 12 Jul 2011
4 answers
313 views
Hi there
The situation is the following:
I am in need of having custom ticks on the X-axis in the form of DateTimes, jeg AutoRange doesnt seem to be working for me when i have ticks with same date but different time of day.
I have tried setting AutoRange to false, and creating ticks my self but this gives me no graphs at all, can someone tell me what I am missing here?

Following is from my code-behind:
private void SetupGraph()
{
    radChart.ItemsSource = dataContext.Points;
    var seriesMappings = CreateSeriesMappings();
    var axisX = new AxisX
        {
            DefaultLabelFormat = "dd-MM-yy",
            LabelRotationAngle = 45,
            Step = 1,
            LabelStep = 1,
            AutoRange = false,
            IsDateTime = true                                  
        };
  
        var tickPoints = dataContext.Points.SelectMany(gp => gp).Select(gp => gp.Date).Distinct().Select(dt => new TickPoint(){IsDateTime = true, Label = dt.ToShortDateString(), Value = dt.ToOADate()});
    axisX.TickPoints.AddRange(tickPoints);
  
    var axisY = new AxisY { DefaultLabelFormat = "N3", };
    var chartArea = new ChartArea { AxisX = axisX, AxisY = axisY, LegendName = "legend" };
    var chartLegend = new ChartLegend { Name = "legend", UseAutoGeneratedItems = true, Width = 145 };
    var chartTitle = new ChartTitle { Content = "Graph" };
    var chartDefaultView = new ChartDefaultView
        {
            ChartArea = chartArea,
            ChartTitle = chartTitle,
            ChartLegend = chartLegend,
        };
  
        radChart.SeriesMappings.AddRange(seriesMappings);
        radChart.DefaultView = chartDefaultView;
        radChart.AnimationSettings = new AnimationSettings() { TotalSeriesAnimationDuration = new TimeSpan(0, 0, 0, 00), ItemAnimationDuration = new TimeSpan(0,0,0,0), ItemDelay = new TimeSpan(0,0,0,0)};
        radChart.Rebind();
}
KADI
Top achievements
Rank 1
 answered on 12 Jul 2011
3 answers
79 views
Hi,

I updated to the beta because I want to try out the new PropertyGrid. I noticed, that the Drag&Drop behaviour changed from the Q1 SP1 release. Now when I drag an item from another control onto the target TLV I'll get a red stop sign. The DropQuery-Event is not fired so I guess that the DragAndDropManager thinks, that the item is not over the control. This worked perfectly with the previous release.

Is this a bug or a feature? And will this be changed to the old behaviour with the final release of Q2?

Greets
Hans
Tsvyatko
Telerik team
 answered on 12 Jul 2011
5 answers
182 views

Hello

Is there property can user edit row?

Best regards

Ehud

Dimitrina
Telerik team
 answered on 12 Jul 2011
2 answers
336 views
Hi Support

I implement INotifyDataErrorInfo for my class ,It shows exception right in GridView But allow user to exit cell with invalid data.
I want to force user to correct data before leaving cell how can I do that?

public

class TestClass : INotifyDataErrorInfo  

{

        int code; 
                public int Code  

                {

                    get {return code; }

                    set 
                    {
            IsCodeValid(
value); 

            if (code != value) code = value;  

                    }

                }

        string name;

        public string Name  

                {

                    get {return name; }

                    set {name = value; }

                }

public bool IsCodeValid(int value)  

{

bool isValid = true;

if (value == 0)

{

AddError("Code", "Code Err!", false);

isValid = false;  

}

else RemoveError("Code", "Code Err!");

return isValid;

}
private
Dictionary<String, List<String>> errors = new Dictionary<string, List<string>>();

public void AddError(string propertyName, string error, bool isWarning)

{

if (!errors.ContainsKey(propertyName))  

errors[propertyName] = new List<string>();

if (!errors[propertyName].Contains(error))

{

if (isWarning) errors[propertyName].Add(error);

else errors[propertyName].Insert(0, error);

RaiseErrorsChanged(propertyName);

}

}

public void RemoveError(string propertyName, string error)  

{

if (errors.ContainsKey(propertyName) && errors[propertyName].Contains(error))

{

errors[propertyName].Remove(error);

if (errors[propertyName].Count == 0) errors.Remove(propertyName);

RaiseErrorsChanged(propertyName);

}

}

public void RaiseErrorsChanged(string propertyName)

{

if (ErrorsChanged != null)

ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName));

}

#region

INotifyDataErrorInfo Members

public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;

public System.Collections.IEnumerable GetErrors(string propertyName)

{

if (String.IsNullOrEmpty(propertyName) || !errors.ContainsKey(propertyName))

return null;

return errors[propertyName];

}

public bool HasErrors

{

get { return errors.Count > 0; }

}

#endregion

 

 

}

 

 

<telerik:RadGridView Name="radGridView1" AutoGenerateColumns="False" ItemsSource="{Binding ColData}" >

 

<telerik:RadGridView.Columns>

 

<telerik:GridViewDataColumn Header="Code" DataMemberBinding="{Binding Code}" ValidatesOnDataErrors="Default" />

 

<telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}" />

 

</telerik:RadGridView.Columns>

 

</telerik:RadGridView>

Mehri
Top achievements
Rank 1
 answered on 12 Jul 2011
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?