I must be missing something simple. I'm just trying to work with the background colors for the TabItems. I've made a Control Template and Style. When I explore the Live Visual Tree, I find that BorderVisual is being defined from the default Implicit Styles file. Everything else above seems to be pulling correctly from the Style and Template I've made. What am I doing wrong?
<
ResourceDictionary
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerik1
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
xmlns:telerikNavigation
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
xmlns:telerikPrimitives
=
"clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls"
xmlns:telerikTabControl
=
"clr-namespace:Telerik.Windows.Controls.TabControl;assembly=Telerik.Windows.Controls.Navigation"
xmlns:telerikNavigationPrimitives
=
"clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls.Navigation"
>
<
ControlTemplate
x:Key
=
"JobTypeTabItemTemplate"
TargetType
=
"{x:Type telerik:RadTabItem}"
>
<
Grid
x:Name
=
"wrapper"
>
<
Border
x:Name
=
"BorderVisual"
CornerRadius
=
"3,3,0,0"
BorderBrush
=
"{TemplateBinding BorderBrush}"
Background
=
"{TemplateBinding Background}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
/>
<
telerikPrimitives:LayoutTransformControl
x:Name
=
"OrientationTransform"
>
<
ContentControl
x:Name
=
"HeaderElement"
IsTabStop
=
"False"
Content
=
"{TemplateBinding Header}"
ContentTemplate
=
"{TemplateBinding HeaderTemplate}"
Foreground
=
"{TemplateBinding HeaderForeground}"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
Margin
=
"{TemplateBinding Padding}"
ContentStringFormat
=
"{TemplateBinding HeaderStringFormat}"
ContentTemplateSelector
=
"{TemplateBinding HeaderTemplateSelector}"
SnapsToDevicePixels
=
"True"
/>
</
telerikPrimitives:LayoutTransformControl
>
</
Grid
>
<
ControlTemplate.Triggers
>
<
Trigger
Property
=
"IsMouseOver"
Value
=
"True"
>
<!--<
Setter
TargetName
=
"BorderVisual"
Property
=
"Background"
Value
=
"{telerik1:Office2016Resource ResourceKey=AccentMouseOverBrush}"
/>
<
Setter
TargetName
=
"BorderVisual"
Property
=
"BorderBrush"
Value
=
"{telerik1:Office2016Resource ResourceKey=AccentMouseOverBrush}"
/>-->
<
Setter
TargetName
=
"BorderVisual"
Property
=
"Background"
Value
=
"{telerik1:Office2016Resource ResourceKey=AlternativeBrush}"
/>
<
Setter
TargetName
=
"BorderVisual"
Property
=
"BorderBrush"
Value
=
"{telerik1:Office2016Resource ResourceKey=AlternativeBrush}"
/>
<
Setter
TargetName
=
"HeaderElement"
Property
=
"Foreground"
Value
=
"{telerik1:Office2016Resource ResourceKey=MarkerBrush}"
/>
</
Trigger
>
<
Trigger
Property
=
"IsSelected"
Value
=
"True"
>
<!--<
Setter
TargetName
=
"BorderVisual"
Property
=
"Background"
Value
=
"{telerik1:Office2016Resource ResourceKey=AlternativeBrush}"
/>
<
Setter
TargetName
=
"BorderVisual"
Property
=
"BorderBrush"
Value
=
"{telerik1:Office2016Resource ResourceKey=AlternativeBrush}"
/>-->
<
Setter
TargetName
=
"BorderVisual"
Property
=
"Background"
Value
=
"{telerik1:Office2016Resource ResourceKey=AccentMouseOverBrush}"
/>
<
Setter
TargetName
=
"BorderVisual"
Property
=
"BorderBrush"
Value
=
"{telerik1:Office2016Resource ResourceKey=AccentMouseOverBrush}"
/>
<
Setter
TargetName
=
"HeaderElement"
Property
=
"Foreground"
Value
=
"{telerik1:Office2016Resource ResourceKey=MarkerInvertedBrush}"
/>
</
Trigger
>
</
ControlTemplate.Triggers
>
</
ControlTemplate
>
<
Style
x:Key
=
"JobTypeTabItemStyle"
TargetType
=
"{x:Type telerik:RadTabItem}"
BasedOn
=
"{StaticResource RadTabItemStyle}"
>
<
Setter
Property
=
"Template"
Value
=
"{StaticResource JobTypeTabItemTemplate}"
/>
<
Setter
Property
=
"FontFamily"
Value
=
"{telerik1:Office2016Resource ResourceKey=FontFamily}"
/>
<
Setter
Property
=
"Background"
Value
=
"Transparent"
/>
<
Setter
Property
=
"BorderThickness"
Value
=
"1 1 1 0"
/>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"VerticalContentAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"MinWidth"
Value
=
"5"
/>
<
Setter
Property
=
"MinHeight"
Value
=
"5"
/>
<
Setter
Property
=
"HeaderForeground"
Value
=
"{telerik1:Office2016Resource ResourceKey=MarkerInvertedBrush}"
/>
<
Setter
Property
=
"SnapsToDevicePixels"
Value
=
"True"
/>
<
Setter
Property
=
"FocusVisualStyle"
Value
=
"{x:Null}"
/>
<
Setter
Property
=
"Template"
Value
=
"{StaticResource TabItemTemplate}"
/>
<
Setter
Property
=
"Padding"
Value
=
"18,6,18,3"
/>
<
Setter
Property
=
"Header"
Value
=
"{Binding TabText}"
/>
<
Setter
Property
=
"FontSize"
Value
=
"14"
/>
</
Style
>
</
ResourceDictionary
>
Hi, I has a diagram, and use ExportToImage method to export to png, but the png file is 0KB, and can't diaplay in windows photo viewer, why?
The code is:
namespace OpenDiagramdemo
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public RadDiagram diagram;
public MainWindow()
{
InitializeComponent();
diagram = new RadDiagram();
//the shapes up to 500, display is slow
for(int i = 0; i < 1000; i++)
{
RadDiagramShape s = new RadDiagramShape();
s.Stroke = Brushes.Red;
s.BorderBrush = Brushes.Red;
s.StrokeThickness = 2;
s.IsEditable = false;
s.Foreground = Brushes.Transparent;
s.Background = Brushes.Transparent;
s.Width = 113;
s.Height = 76;
s.X = i;
s.Y = i;
s.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.EllipseShape);//"M0.5,0.5L111.5,0.5 111.5,74.5 0.5,74.5z"
diagram.AddShape(s);
}
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
FileStream fs = File.Open("D:\\\\tt.png", FileMode.Create);
this.diagram.ExportToImage(fs);
fs.Close();
}
}
}
When run this program, make a diagram And draw a menu in xaml. Define the menu click event MenuItem_Click. Click menu and see the result described above.
Thanks!
Hi, I have problem with RadialGauge. When I set BarIndicator value = 100 and it disappear. Please help me!
<
telerik:RadRadialGauge
x:Name
=
"radGauge"
>
<
telerik:RadialScale
x:Name
=
"radialScale"
IsInteractive
=
"True"
RangeLocation
=
"OverOutside"
LabelRotationMode
=
"None"
Radius
=
"0.9"
StartAngle
=
"270"
SweepAngle
=
"360"
Max
=
"100"
MinorTickBackground
=
"Transparent"
MiddleTickBackground
=
"Transparent"
MajorTickBackground
=
"Transparent"
ShowLastLabel
=
"False"
LabelTemplate
=
"{StaticResource CustomRadialLabelTemplate}"
>
<
telerik:RadialScale.Indicators
>
<
telerik:BarIndicator
x:Name
=
"bar"
StartWidth
=
"0.15"
EndWidth
=
"0.15"
EmptyFill
=
"LightGray"
telerik:ScaleObject.Location
=
"OverCenter"
/>
</
telerik:RadialScale.Indicators
>
</
telerik:RadialScale
>
</
telerik:RadRadialGauge
>
Hey community,
the row redorder sample doesn't work within a RadLayoutControl. It looks like as if the RadLayoutControl would intercept the DragEvent, so the GiveFeedbackEventArgs is not called within the RowReorderBehavior.
Can you provide me a sample or give me a hint please.
Kind regards,
Lars
I am using a radGridView in Master/Detail scenario using MVVM; the selected item is displayed in a custom form that allows editing.
The Form's DataContext and the Grid's SelectedItem are bound to a property in the ViewModel.
When the Grid's selection is changing, I check if the Form is in Edit mode, and if so I cancel the selection change.
This works as it should.
However, there are some circumstances where the Grid's ItemSource (CollectionViewSource) changes and the Grid looses track of the SelectedItem. I can throw NotifyPropertyChanged on the property, and the grid doesn't notice. When the grid is in this state and the user selects a row, the logic in SelectionChanging does not prevent the SelectedItem from changing. In fact it sets the SelectedItem to null, rather than the attempted selection row.
I really need to prevent the SelectedItem from changing (or becoming null) while the item is being edited. I think the best way would be to prevent the grid from getting into this strange state.
How can I force the grid to realize its SelectedItem, if NotifyPropertyChanged is not doing the trick?
Does the grid loose its SelectedItem binding when the Itemssource updates?
XAML:
<telerik:RadGridView Grid.RowSpan="2" ShowGroupPanel="False" AutoGenerateColumns="False" IsFilteringAllowed="False"
ItemsSource="{Binding Zones.View}" x:Name="grd_ZoneBins" IsReadOnly="True" EditTriggers="None"
SelectedItem="{Binding SelectedZone, Mode=TwoWay}"
SelectionChanging="grd_ZoneBins_SelectionChanging" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Zone" DataMemberBinding="{Binding Name}" Width="*" />
<telerik:GridViewDataColumn Header="Active" DataMemberBinding="{Binding IsActive}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
CodeBehind:
private void grd_ZoneBins_SelectionChanging(object sender, Telerik.Windows.Controls.SelectionChangingEventArgs e)
{
if (EditableWorkSpace_ZoneBins.Mode == EditMode.Editable) //this is a custom control
e.Cancel = true;
}
ViewModel:
//Properties
private List<Part_Zone> _zones;
public CollectionViewSource Zones { get; set; }
private Part_Zone m_SelectedZone;
public Part_Zone SelectedZone
{
get { return m_SelectedZone; }
set { m_SelectedZone = value; NotifyPropertyChanged("SelectedZone");}
}
public Model() //constructor
{
Zones = new CollectionViewSource();
Zones.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
LoadData();
}
private void LoadData()
{
_zones = GetZones();
Zones.Source = _zones;
SelectedZone = Zones.View.CurrentItem as Part_Zone; //first item
}
public void Refresh()
{
LoadData();
//at this point the grid doesn't seem aware that the SelectedZone is its SelectedItem
}
public void StartEdit()
{
View.EditableWorkSpace_ZoneBins.Mode = EditMode.Editable;
NotifyPropertyChanged("SelectedZone"); // just in case
}
Steps to reproduce:
1) load data
2) select item in grid
3) refresh data - grid looses selectedItem. SelectedZone is not null.
4) start edit
5) change selection - gets canceled due to Edit mode
6) SelectedZone is set to null.
Dear Admin
I just use RadGridView control for excel content shown in MVVM pattern, and before amount excel data, I do not know exact columns and rows shown in RadGridView, so I use datatable as my datasource binded to RadGridView's ItemsSource. But actually I would like to change some columns datatype from string to Image, I try to add AutoGeneratingColumn event and set CellTemplate for specified columns, and the result was that there was no response after loading and only shut-down whole window.
so in this case is there any other workaround to archive similar case? any ideas I do really appreciate.
if (e.DataElement != null)
{
((GridViewCell)e.Row.Cells[7]).BeginEdit();
}
Hello,
I have a combobox on which i am trying to modify the default tooltip style.This is applicable when I am hovering on individual combobox items and I should get the tooltip. Right now for tooltip , we are showing up the text value. But I want to override this deafult style and show the description instead. (Note that description is a user defined property).
The code snippet right now is:
<Style.Resources>
<Style TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource ComboBoxItemStyle}">
<!--<Setter Property="ToolTip" Value="{Binding ToolTipDescription, Mode=TwoWay}"/>-->
<Setter Property="ToolTip" Value="{Binding}"/>
</Style>
</Style.Resources>
Here while setting the property "tooltip" <Setter Property="ToolTip" Value="{Binding ToolTipDescription, Mode=TwoWay}"/>. I tried doing something like this. Here I exposed a public property from my class which is holding the description value that I need to show when i am hovering on the individual item. But the binding is not working.
I need your input to proceed further.