Hi everyone
I need to give each item in a RadCombobox a very specific color..
My XAML is:
<telerik:RadComboBox x:Name="cmbToolTypeForLoad" ItemsSource="{Binding ToolTypeForCmb}" DisplayMemberPath="Description" Margin="46,29,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="421" Height="48" >
<ComboBoxItem>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="{Binding Color}"/>
</Style>
</ComboBoxItem>
</telerik:RadComboBox>
to populate my combobox I had to convert the integer color stored in SQL:
public partial class ToolTypeForCmb
{
public int ToolTypeId { get; set; }
public string Description { get; set; }
public Brush Color { get; set; }
}
List<ToolType> toolTypes = toolTypeService.GetAll(MachineryCode);
List<ToolTypeForCmb> toolTypeForCmb = new List<ToolTypeForCmb>();
foreach (ToolType toolType in toolTypes)
{
ToolTypeForCmb ttfcmb = new ToolTypeForCmb();
ttfcmb.Color = UtilityService.ConvertIntToColorBrush(toolType.Color);
ttfcmb.Description = toolType.Description;
ttfcmb.ToolTypeId = toolType.ToolTypeId;
toolTypeForCmb.Add(ttfcmb);
}
cmbToolTypeForLoad.ItemsSource = toolTypeForCmb;
Unfortunately, it generates an error when I assign the item.
"The collection of items must be empty before you can use ItemsSource".
how can i solve?
thanks
Hi All,
I am using RadGridView in WPF application with MVVM light. In celltemplate i am able to bind relay command for button but i am getting null argument on click event.
Sample Code:
<UserControl
..
DataContext="{Binding SearchControlVM, Source={StaticResource Locator}}"
</UserControl>
..
<telerik:RadGridView
..
<telerik:GridViewColumn.CellTemplate>
<DataTemplate>
<telerik:RadButton Content="View" Command="{Binding Path=DataContext.ViewCommand,
RelativeSource={RelativeSource FindAncestor,AncestorType=telerik:RadGridView}}" />
..
</telerik:RadGridView>
How to pass argument to MVVMlight relay command. Any help would be appreciated.
Thanks,
Prashant
Hello,
I have a hierarchical grid similar to this layout https://docs.telerik.com/devtools/wpf/controls/radgridview/getting-started/building-hierarchical-grid-view
I need to be able to navigate through the parent grid and all the child grids using only a keyboard. My expected behavior is as follows:
Right now I have the following problems
Questions:
Hi,
I would like to Export my Document to string. In my older Version 2019.1.116 the following code works fine:
In this case I can use Telerik.Windows.Documents.FormatProviders.Html.HTMLFormatProvider
HtmlFormatProvider provider = new HtmlFormatProvider() { ExportSettings = new HtmlExportSettings() };
string comment = provider.Export(radRichTextBox.Document);
After Update 2019.3.1023 it doesn't work anymore and I have to use Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider
Same with the exportsettings:
provider.ExportSettings.ExportFontStylesAsTags = true;
provider.ExportSettings.ExportHeadingsAsTags = true;
provider.ExportSettings.StyleRepositoryExportMode = StyleRepositoryExportMode.DontExportStyles;
provider.ExportSettings.ExportLocalOrStyleValueSource = true;
provider.ExportSettings.PropertiesToIgnore["span"].Add("font-family");
provider.ExportSettings.PropertiesToIgnore["p"].Add("margin-top");
provider.ExportSettings.PropertiesToIgnore["p"].Add("margin-bottom");
only the following settings work:
provider.ExportSettings.StylesExportMode = StylesExportMode.Inline;
provider.ExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;
What do I have to do to use the old methods again or achieve the same behaviour?
Regards,
Frank
Hello,
I have a case when the grid view must display plenty of data in a cell (in a log display). To avoid having very high rows, I have defined a template for the cell, as following:
<
tk:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
ScrollViewer
Background
=
"Transparent"
BorderThickness
=
"0"
Margin
=
"0 1"
MaxHeight
=
"150"
>
<
TextBlock
Text
=
"{Binding Request}"
/>
</
ScrollViewer
>
</
DataTemplate
>
</
tk:GridViewDataColumn.CellTemplate
>
The problem is that, when I click on the cell, the row is not selected.
Hello,
I'm trying to use a read-only syntax editor inside a GridView. The goal is to display XML data in the grid view with syntax highlighting.
As the SyntaxEditor needs code to populate it, I defined a descendant class with Language and Text dependency properties
My first try was to use the following code for the cell:
<
tk:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
os:osRadSyntaxEditor
Background
=
"Transparent"
IsReadOnly
=
"True"
Language
=
"Xml"
Text
=
"{Binding Request}"
/>
</
DataTemplate
>
</
tk:GridViewDataColumn.CellTemplate
>
The problems are the following:
To avoid problem 3, I've tried to set a maximum height for the control, using MaxHeight="150". Now, each grid view row has a height of 150, even if the content is smaller.
Hi everybody
I need to list a series of tools in a radcombobox where each color has a color associated with it.
The class of the tool is:
public partial class ToolType
{
public int ToolTypeId {get; set; }
public string Description {get; set; }
public int Color {get; set; }
public RecordState RecordState {get; set; }
public string MachineryCode {get; set; }
public int OwnerId {get; set; }
}
where necessarily I had to transform the color to integer to be able to memorize it in SQL.
So I created a class to be able to use it in my RadCombobox to highlight on each item the color associated with my tool.
public partial class ToolTypeForCmb
{
public int ToolTypeId {get; set; }
public string Description {get; set; }
public Brush Color {get; set; }
}
So in my Xaml I created the RadCombobox:
<telerik:RadComboBox x:Name="cmbToolTypeForLoad" ItemsSource="{Binding ToolTypeForCmb}" DisplayMemberPath="Description" Margin="46,29,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="421" Height="48" >
<ComboBoxItem>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="{Binding Color}"/>
</Style>
</ComboBoxItem>
</telerik:RadComboBox>
List<ToolType> toolTypes = toolTypeService.GetAll(MachineryCode);
List<ToolTypeForCmb> toolTypeForCmb = new List<ToolTypeForCmb>();
foreach (ToolType toolType in toolTypes)
{
ToolTypeForCmb ttfcmb = new ToolTypeForCmb();
ttfcmb.Color = UtilityService.ConvertIntToColorBrush(toolType.Color);
ttfcmb.Description = toolType.Description;
ttfcmb.ToolTypeId = toolType.ToolTypeId;
toolTypeForCmb.Add(ttfcmb);
}
cmbToolTypeForLoad.ItemsSource = toolTypeForCmb;
Is possible add a custom sort for children? Or sort just parents?
It happens only on some of our client's computers even for the simplest demo. I can't repeat it in development environment.
The OS is Windows 7 x64, .net framework version is 4.7.2.
The operation triggers the error is just dropping down and select items.
I think the problem happens when rendering the selectionbox.