I have a radpane include a context menu. when right click over context menu, Radpane is closing and it'is problem for this component.
I used contextmenuopening event but it works before closing and it is not good idea
code is below:
<telerik:RadPaneGroup Margin="0,0,0,0" >
<telerik:RadPane Name="PaneProcess" CanUserClose="False" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<telerik:RadWatermarkTextBox x:Name="FilterTree" Grid.Column="0" Grid.Row="0" BorderThickness="1"
Margin="0,0,0,0"
VerticalAlignment="Top"
MinHeight="24" />
<c:TreeViewProcess x:Name="treeViewProcess" IsDragDropEnabled="True" Grid.Row="1" />
</Grid>
</telerik:RadPane>
</telerik:RadPaneGroup>Hi, I wanted to know if it's possible to change the color of tasks in the colum area. In my case, I need to put colum background on blue if the task has a children. I put an example below of how I want to be the result.
I have a ScheduleView .xaml like this:
<Window>
...
<Grid>
<telerik:RadScheduleView AppointmentsSource="{Binding Appointments}"
<telerik:RadScheduleView.ViewDefinitions>
<telerik:DayViewDefinition/>
<telerik:WeekViewDefinition/>
<telerik:MonthViewDefinition/>
</telerik:RadScheduleView.ViewDefinitions>
</telerik:RadScheduleView>
</Grid>
</Window>
And every time I open the window, my ViewModel is loading the Appointments like this:
Appointments = new ObservableCollection<Appointment>();
private async Task CreateAppointments()
{
Appointments = await _service.GetAllAppointments();
}
While the _service retrieves the data from the server only once and saves it to memory as an ObservableCollection, and next time brings it just from memory.
The first time I opened the Schedule window, everything is working well.
But the next time I opened the Schedule window, I can see that the Week-view and the Day-view are looking the same. if I am trying to press the Day or Week buttons the view is jumping forth and back and stayed the same. (see pictures attached).
I notice that if I'm just changing my code to be like this: (no other changes)
private async Task CreateAppointments()
{
Appointments.AddRange(await _service.GetAllAppointments());
}
It makes the issue disappear and all is working well.
But I don't want to use AddRange because I need my UI to be bounded directly to the ObservableCollection from the _service so I can be notified on any collection changed by the _service side.
[update:]
After this, I found that if I set Appointments to null on the window close, all back to work well (without the need to use AddRange),
I just added to the code behind like this:
private void ScheduleWindowView_OnClosed(object sender, WindowClosedEventArgs e)
{
(DataContext as IDisposable)?.Dispose();
}
And I also added to my ViewModel this implementation:
protected override void Dispose(bool disposing)
I can live with this solution, but can anyone explain what exactly was the issue and how it was solved?
I am trying to achieve customized slider control required customizations are :
1.Thumb with the teal color
2.Repeat buttons end with rounded corners
3.Inside tick bar ticks as circles or ellipse instead of lines(please refer attached image.png file blue arrow mark)
I am able achieve first and second points above, but third point I am not getting.
<Window x:Class="SliderControl.MainWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SliderControl"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<Style TargetType="Slider" x:Key="SliderStyle">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="IsTabStop" Value="false" />
<Setter Property="Focusable" Value="false" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Slider">
<Track Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="Slider.DecreaseLarge">
<RepeatButton.Style>
<Style TargetType="RepeatButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Grid>
<Border BorderBrush="#CACACA" BorderThickness="1" CornerRadius="7,0,0,7" Background="#CACACA" Height="15" >
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</RepeatButton.Style>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="Slider.IncreaseLarge" >
<RepeatButton.Style>
<Style TargetType="RepeatButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Grid >
<Border BorderBrush="#CACACA" BorderThickness="1" CornerRadius="0,7,7,0" Background="#CACACA" Height="15" >
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</RepeatButton.Style>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb>
<Thumb.Style>
<Style TargetType="Thumb">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Canvas>
<Rectangle Canvas.Left="4" Canvas.Bottom="-3.7" Fill="Teal" Width="12" Height="15" Margin="-8,0,0,5" Stroke="Teal"/>
<Path Fill="Teal" Data="M 0 10 L 20 10 L 10 0 Z" Canvas.Left="-4" Stretch="Fill" Width="12" Height="9.333"/>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Thumb.Style>
</Thumb>
</Track.Thumb>
</Track>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<StackPanel HorizontalAlignment="Center" Height="100" VerticalAlignment="Center" Width="400">
<Slider Height="25" Width="250" Margin="30" Maximum="5" Minimum="1" Value="0" Cursor="Hand"
TickPlacement="Both" TickFrequency="1" Ticks="1, 2, 3, 4, 5" Name="Slider" Style="{StaticResource SliderStyle}">
</Slider>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Width="80" Margin="70,-20,0,0"
Text="{Binding ElementName=Slider, Path=Value}"></TextBlock>
</StackPanel>
</Grid>
</Window>
Can you please help me ,how to get circles inside tickbar in wpf .
<Window x:Class="DockingTest.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Width="525" Height="350"> <Window.Resources> <Style x:Key="ContextMenuStyle" TargetType="telerik:RadContextMenu"> <Setter Property="FontSize" Value="11" /> </Style> <telerik:RadContextMenu x:Key="contextMenuCode" Style="{StaticResource ContextMenuStyle}"> <telerik:RadContextMenu.Items> <!-- Visibility of menu items is controlled by RadContextMenu_Opened --> <telerik:RadMenuItem Header="View/Edit Abstracts" /> <telerik:RadMenuSeparatorItem /> <telerik:RadMenuItem Header="Set Admitting" /> <telerik:RadMenuItem Header="Set Principal" /> <telerik:RadMenuSeparatorItem /> <telerik:RadMenuItem Header="Move Code"> <telerik:RadMenuItem Header="Move Down" /> <telerik:RadMenuItem Header="Move Up" /> </telerik:RadMenuItem> </telerik:RadContextMenu.Items> </telerik:RadContextMenu> </Window.Resources> <telerik:RadDocking x:Name="DockingControl" Grid.Row="1" MaxWidth="5000" MaxHeight="5000" Background="Transparent" BorderThickness="0" telerik:AnimationManager.AnimationSelector="{x:Null}" telerik:AnimationManager.IsAnimationEnabled="False" telerik:RadContextMenu.ContextMenu="{StaticResource contextMenuCode}"> <telerik:RadDocking.DocumentHost> <telerik:RadSplitContainer> <telerik:RadPaneGroup x:Name="PaneGroup" telerik:RadDocking.SerializationTag="PaneGroup"> <telerik:RadPane CanFloat="False" CanUserClose="False" ContextMenuTemplate="{x:Null}" Header="Document" /> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking.DocumentHost> <telerik:RadSplitContainer InitialPosition="DockedLeft" Orientation="Horizontal" telerik:DockingPanel.InitialSize="200,10"> <telerik:RadSplitContainer InitialPosition="DockedLeft" Orientation="Vertical" telerik:DockingPanel.InitialSize="200,10"> <telerik:RadPaneGroup> <telerik:RadPane CanDockInDocumentHost="False" CanFloat="True" CanUserClose="False" CanUserPin="True" ContextMenuTemplate="{x:Null}" Header="Test" IsPinned="False"> <telerik:RadGridView x:Name="Grid"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Temp1}" Header="Temp1" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Temp2}" Header="Temp2" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Temp3}" Header="Temp3" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Temp4}" Header="Temp4" /> </telerik:RadGridView.Columns> </telerik:RadGridView> </telerik:RadPane> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadSplitContainer> </telerik:RadDocking></Window>Hi,
Would it be possible to have a editable RadComboBox TextBox Part to mimic the RadWatermarkTextBox with floating Label?
Please consider the attached image.
How can I prevent the editor from line breaking when the selected item in the combobox fills out the whole (or more) width of the combobox editor? I want it to keep the height of a single line and just scroll the text, like in a single line textbox.
Hi,
I try to select a child item in a TreeListView WO succes... When I try to select the root node it works fine.
Did I miss something ?
Thanks!
This is my code:
<Grid x:Name="layoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<Button x:Name="button" Height="20" Command="{Binding CmdAdd}">Add</Button>
<Button x:Name="button2" Height="20" Command="{Binding CmdSelectLastItemAdded}">Select last child added</Button>
<Button x:Name="button3" Height="20" Command="{Binding CmdSelectRootNode}">Select root</Button>
</StackPanel>
<!-- The Tree -->
<telerik:RadTreeListView x:Name="TreeListView" ItemsSource="{Binding Items}"
CanUserFreezeColumns="False"
RowIndicatorVisibility="Collapsed"
ColumnWidth="auto"
AutoGenerateColumns="False"
IsDragDropEnabled="True"
IsDropPreviewLineEnabled="False"
ShowColumnHeaders="True"
SelectionMode="Extended"
GridLinesVisibility="None"
IsSynchronizedWithCurrentItem="False"
SelectedItem="{Binding SelectedItem , Mode=TwoWay}"
IsExpandedBinding="{Binding IsExpandedInTree, Mode=TwoWay}"
Margin="5" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4">
<!-- The columns -->
<telerik:RadTreeListView.Columns>
<telerik:GridViewColumn Name="colName" Header="Name" FilterMemberPath="DisplayName">
<telerik:GridViewColumn.CellTemplate>
<DataTemplate DataType="local:ITreeItem">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<CheckBox IsChecked="{Binding IsVisible, Mode=OneWay}" />
<TextBlock Text="{Binding DisplayName}" Grid.Column="2" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
<telerik:GridViewColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding DisplayName}" Margin="2"/>
</DataTemplate>
</telerik:GridViewColumn.CellEditTemplate>
</telerik:GridViewColumn>
</telerik:RadTreeListView.Columns>
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Children}" />
</telerik:RadTreeListView.ChildTableDefinitions>
</telerik:RadTreeListView>
</Grid> public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
TreeListView.RowHeight = 20;
var vm = new TreeVM();
DataContext = vm;
}
public class TreeVM : ReactiveObject
{
private TreeItem _lastItemAdded;
private TreeItem _firstItem;
public Action <TreeItem> action { get; set; }
private TreeItem _selectedItem;
public TreeItem SelectedItem
{
get => _selectedItem;
set => this.RaiseAndSetIfChanged(ref _selectedItem, value);
}
public ICommand CmdAdd { get; }
public ICommand CmdSelectLastItemAdded { get; }
public ICommand CmdSelectRootNode { get; }
public TreeVM()
{
_items = new ObservableCollection<ITreeItem>();
_firstItem = new TreeItem();
_firstItem.DisplayName = "Root";
_items.Add(_firstItem);
CmdAdd = ReactiveCommand.Create(AddChild);
CmdSelectLastItemAdded = ReactiveCommand.Create(Select);
CmdSelectRootNode = ReactiveCommand.Create(SelectRoot);
}
private void Select()
{
SelectedItem = _lastItemAdded;
}
private void SelectRoot()
{
SelectedItem = _firstItem;
}
private void AddChild()
{
var childitem = new TreeItem();
childitem.DisplayName = "Parent";
var child = new TreeItem();
child.DisplayName = "child1";
childitem.Children.Add(child);
child = new TreeItem();
child.DisplayName = "child2";
childitem.Children.Add(child);
child = new TreeItem();
_items[0].Children.Add(childitem);
_lastItemAdded = child;
}
private ObservableCollection<ITreeItem> _items;
public ObservableCollection<ITreeItem> Items
{
get => _items;
set => this.RaiseAndSetIfChanged(ref _items, value);
}
}
}
Hello,
In a behavior on RadGridView I'm subscribing to KeyDownEvent, and when I press Enter, I execute the following code:
I wanted to check what happens if I hit Enter without selecting any cell in the grid.
So first, I click outside the grid, this selects the first cell of the grid in an "unfocused" style:
Then, I hit Enter a first time: my code hits the first condition (AssociatedObject.SelectedCells.Count == 0) and does the early-return.
It also selects the next cell in the column:
I hit Enter a second time: my code hits the second condition (the one underlined in red), and throws an ArgumentException:
From what I understand, this is raised from CellInfoCollection.Contains, so from code I cannot debug since it's a Telerik dll.
Do you have more info on this? What am I doing wrong?
Thanks!
I have a simple use case where if the Checkbox in column-1 is unchecked there should be some indication in the row (such as the row being grayed out).
In the example below, I would like the unchecked row "40 ,00, 00 00 03...) to be visually different than the checked row above.
What is the easiest way to accomplish this ?
Your help is appreciated.