How do I get StyleRules to work with a DataTable as ItemSource of the GridView?
I have some sample code that has two grid views with the same StyleRules but one uses DataTable and the other uses a list of object 'item'. The list of objects respects the StyleRules but the grid with the DataTable does not and I'm not sure why?
DataTable dt =
new
DataTable();
dt.Columns.Add(
"ID"
,
typeof
(
int
));
dt.Columns.Add(
"Value"
,
typeof
(
int
));
var dr = dt.NewRow();
dr[
"ID"
] = 1;
dr[
"Value"
] = 0;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[
"ID"
] = 2;
dr[
"Value"
] = 1;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[
"ID"
] = 3;
dr[
"Value"
] = 2;
dt.Rows.Add(dr);
RadGridView1.ItemsSource = dt;
List<Item> items =
new
List<Item>(){
new
Item(1,0),
new
Item(2, 1) ,
new
Item(3, 2) };
RadGridView2.ItemsSource = items;
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
TextBlock
Grid.Row
=
"1"
FontSize
=
"16"
Margin
=
"0,0,0,5"
Text
=
"Data Table Item Source"
/>
<
telerik:RadGridView
Grid.Row
=
"2"
x:Name
=
"RadGridView1"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.RowStyleSelector
>
<
telerik:ConditionalStyleSelector
>
<
telerik:StyleRule
Condition="Value > 1">
<
Style
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"Red"
/>
</
Style
>
</
telerik:StyleRule
>
<
telerik:StyleRule
Condition
=
"Value = 1"
>
<
Style
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"Green"
/>
</
Style
>
</
telerik:StyleRule
>
</
telerik:ConditionalStyleSelector
>
</
telerik:RadGridView.RowStyleSelector
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ID}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Value}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
<
TextBlock
Grid.Row
=
"3"
FontSize
=
"16"
Margin
=
"0,10,0,5"
Text
=
"List Object Item Source"
/>
<
telerik:RadGridView
Grid.Row
=
"4"
x:Name
=
"RadGridView2"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.RowStyleSelector
>
<
telerik:ConditionalStyleSelector
>
<
telerik:StyleRule
Condition="Value > 1">
<
Style
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"Red"
/>
</
Style
>
</
telerik:StyleRule
>
<
telerik:StyleRule
Condition
=
"Value = 1"
>
<
Style
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"Green"
/>
</
Style
>
</
telerik:StyleRule
>
</
telerik:ConditionalStyleSelector
>
</
telerik:RadGridView.RowStyleSelector
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ID}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Value}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
Hello,
I'm importing simple HTML and the bullets are showing up as all disc types. They should be square, disc, then circle. Is this a bug or do I need to do something else to make this display correctly? Loading the html into Chrome or IE will show the correct display.
Thanks,
Scott
HtmlFormatProvider htmlFormatProvider = new HtmlFormatProvider();
string htmlString = "<!DOCTYPE html><html><head></head><body><ul><li type='square'>This is a square</li><li type='disc'>This is a disc</li><li type='circle'>This is a circle</li></ul></body></html>";
radRichTextBox.Document = htmlFormatProvider.Import(htmlString);​
Hello,
I'm trying to replace mahapps with telerik in an existing C# mvvm application. In the shell of this application is a mahapps Flyout control. This control is triggered by the region manager.
This Flyout control flies in from the left (like the navigationview is flying in from the right) showing a detail CustomControl. Basically a window containing details of a selected line in a datagrid.
I'm trying to replace this Flyout control with a Telerik control, but without any luck.
The mahapps XAML code looks like:
<controls:MetroWindow.Flyouts>
<controls:FlyoutsControl>
<controls:Flyout Header="{Binding Header}" Position="Right" Width="550" IsOpen="{Binding IsOpen}"
IsPinned="{Binding IsPinned}">
<ContentControl prism:RegionManager.RegionName="{x:Static framework:RegionNames.DetailRegion}" />
</controls:Flyout>
</controls:FlyoutsControl>
</controls:MetroWindow.Flyouts>
Any ideas on how to replace this mahapps Flyout control with a Telerik control? Any suggestions on how to establish the same functionality.
Thanks!
Jochem
Im facing an issue with styling of HTML bullets and numbered list. I want to achieve following output. Bullets and number size gets increase and i don't want that
My Output is :
<ol><li value=\"1\" style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;text-indent: 0px;line-height: 1.15;font-family: 'Verdana';font-size: 16px;color: #000000;\"><span style=\"font-family: 'Segoe UI';font-size: 13.33px;color: #000000;\">Procedure to Clean Oil tank</span></li></ol>
Expected output :
<ol><li value=\"2\"><span style=\"font-family: 'Segoe UI';font-size: 13.33px;color: #000000;\">Procedure to Clean Oil tank</span></li></ol>
Please help
We have a Menu that uses the RadRadialMenu in a WPF Desktop Application. Currently when we try to add more that 8 menu items, we lose one of the menus. It seems that the menu can only take 8 "pie pieces" per menu level. We were wondering if with a little customization, you could add 9, 10, or more. I believe that this might have been discussed in a previous post somewhere, however just thought I would start a new thread to see if anyone has come across this and has a solution.
I was hoping the RadColorPicker would have built in functionality to support the RadColorEditor which is common in just about all applications from Adobe to MS Paint ... something like the attached image.
Telerik doesn't seem to provide a "one stop shop" for this functionality. My expectation was the RadColorPicker would include the functionaltiy of the RadColorEditor, but it does not.
I can code my own solution using a new RadWindow and adding the RadColorEditor but the reason I bought Telerik is so that I wouldn't have to do this work, part of the rapid application development process.
Am I missing some simple functionality available in the RadColorPicker or is this just how it is?
Cheers, Rob.
I read many threads on this issue and I'm just trying to do simple XAML only binding and not MVVM or code behind, but unfortunately I can't get it to work with RadSlider:
<
TextBox
Grid.Row
=
"5"
Grid.Column
=
"4"
Text
=
"{Binding ElementName=slHeightRange,Path=SelectionStart}"
HorizontalAlignment
=
"Right"
/>
<
telerik:RadSlider
x:Name
=
"slHeightRange"
Grid.Row
=
"5"
Grid.Column
=
"5"
Grid.ColumnSpan
=
"1"
Minimum
=
"1"
Maximum
=
"50"
HandlesVisibility
=
"Visible"
TickFrequency
=
"5"
TickPlacement
=
"BottomRight"
IsSelectionRangeEnabled
=
"True"
>
<
telerik:RadSlider.Thumbs
>
<
telerik:RangeSliderThumb
RangeStart
=
"5"
RangeEnd
=
"19"
/>
</
telerik:RadSlider.Thumbs
>
</
telerik:RadSlider
>
<
telerik:Label
Grid.Row
=
"5"
Grid.Column
=
"6"
Content
=
"{Binding ElementName=slHeightRange,Path=SelectionEnd}"
HorizontalAlignment
=
"Right"
/>
Any hints?
Cheers, Rob.
FYI
https://docs.telerik.com/devtools/wpf/controls/radimageeditor/getting-started
In example 3 your trying to pass a RadImageEditor control into a sub that uses RadImageEditorUI. If you change to the following it works:
Public
Shared
Sub
LoadSampleImage(
ByVal
imageEditor
As
RadImageEditor,
ByVal
image
As
String
)
Using stream
As
Stream = Application.GetResourceStream(GetResourceUri(SampleImageFolder & image)).Stream
imageEditor.Image =
New
Telerik.Windows.Media.Imaging.RadBitmap(stream)
imageEditor.ApplyTemplate()
imageEditor.ScaleFactor = 0
End
Using
End
Sub