I am just trying to apply a theme in a mvvm wpf caliburn.micro app. I added references for the necessary no-xaml wpf binaries (Telerik.Windows.Controls/Navigation, Telerik.Windows.Data (Binaries.NoXAML), in addition I added a reference to the required theme (Telerik.Windows.Themes.Green) and added the resources in a merged resource dictionary in my app.xaml.
I still can't get theming to work. Using implicit styled controls, I can't see any data displayed, but not using implicit styles everything is ok!
1) what am I missing?
2) And where should I apply e.g. : GreenPalette.LoadPreset(GreenPalette.ColorVariation.Dark) - in my bottstrapper?;
Thanks for your help.
Oliver
app.xaml
01.<Application x:Class="Notizen.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Notizen">02. <Application.Resources>03. <ResourceDictionary>04. <ResourceDictionary.MergedDictionaries>09. <ResourceDictionary Source="/Telerik.Windows.Themes.Green;component/Themes/Telerik.Windows.Controls.xaml" />10. <ResourceDictionary Source="/Telerik.Windows.Themes.Green;component/Themes/Telerik.Windows.Controls.Navigation.xaml" />-->11. <ResourceDictionary Source="/Telerik.Windows.Themes.Green;component/Themes/System.Windows.xaml" />12. <ResourceDictionary Source="/Telerik.Windows.Themes.Green;component/Themes/Telerik.Windows.Controls.xaml" />13. <ResourceDictionary Source="/Telerik.Windows.Themes.Green;component/Themes/Telerik.Windows.Controls.Navigation.xaml" />14. <ResourceDictionary>15. <local:AppBootstrapper x:Key="bootstrapper" />16. </ResourceDictionary>17. </ResourceDictionary.MergedDictionaries>18. </ResourceDictionary>19. </Application.Resources>20.</Application>
appbootsrapper.cs
01.namespace Notizen {02. using System;03. using System.Collections.Generic;04. using Caliburn.Micro;05. using System.ComponentModel.Composition.Hosting;06. using System.Linq;07. using System.ComponentModel.Composition;08. using System.Windows;09. using Telerik.Windows.Controls;10. public class AppBootstrapper : BootstrapperBase {11. 12. private CompositionContainer container;13. 14. public AppBootstrapper()15. {16. Initialize();17. }18. 19. protected override void Configure()20. {21. container = new CompositionContainer(22. new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)))23. );24. 25. var batch = new CompositionBatch();26. 27. batch.AddExportedValue<IWindowManager>(new WindowManager());28. //batch.AddExportedValue<IWindowManager>(new TelerikWindowManager());29. batch.AddExportedValue<IEventAggregator>(new EventAggregator());30. batch.AddExportedValue(container);31. 32. // This is essential to enable Telerik's conventions33. TelerikExtensions.TelerikConventions.Install();34. 35. GreenPalette.LoadPreset(GreenPalette.ColorVariation.Dark);36. //StyleManager.ApplicationTheme = ThemeManager.FromName("Expression_Dark");37. 38. container.Compose(batch);39. }40. 41. protected override object GetInstance(Type serviceType, string key)42. {43. string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key;44. var exports = container.GetExportedValues<object>(contract);45. 46. if (exports.Any())47. return exports.First();48. 49. throw new Exception(string.Format("Could not locate any instances of contract {0}.", contract));50. }51. 52. protected override IEnumerable<object> GetAllInstances(Type serviceType)53. {54. return container.GetExportedValues<object>(AttributedModelServices.GetContractName(serviceType));55. }56. 57. protected override void BuildUp(object instance)58. {59. container.SatisfyImportsOnce(instance);60. }61. 62. protected override void OnStartup(object sender, StartupEventArgs e)63. {64. DisplayRootViewFor<IShell>();65. }66. 67. }68.}tagsView.xaml
01.<UserControl x:Class="Notizen.Views.TagsView"03. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"04. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"05. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"06. xmlns:local="clr-namespace:Notizen.Views"07. xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"08. xmlns:vm="clr-namespace:Notizen.ViewModels"09. mc:Ignorable="d"10. d:DesignHeight="300" d:DesignWidth="300">11. <UserControl.Resources>12. 13. <Style x:Key="radTreeViewItemStyle" TargetType="{x:Type telerik:RadTreeViewItem}">14. <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />15. <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />16. <Setter Property="FontWeight" Value="Normal" />17. <Style.Triggers>18. <Trigger Property="IsSelected" Value="True">19. <Setter Property="FontWeight" Value="Bold" />20. </Trigger>21. </Style.Triggers>22. </Style>23. 24. <HierarchicalDataTemplate x:Key="hierarchicalDataTemplate"25. DataType="{x:Type vm:TagViewModel}"26. ItemsSource="{Binding Tags}">27. <DockPanel LastChildFill="True">28. <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right">29. <TextBlock Text="{Binding Count}" Padding="0,0,5,0" Foreground="Gray" />30. </StackPanel>31. <StackPanel DockPanel.Dock="Left" Orientation="Horizontal">32. 33. <!--<Image Width="16" Height="16" Margin="3,0" Source="Images\RegionXX.png" />-->34. <TextBlock Text="{Binding Name}" Foreground="#FF1E4BAC" />35. </StackPanel>36. 37. </DockPanel>38. </HierarchicalDataTemplate>39. </UserControl.Resources>40. <DockPanel LastChildFill="True">41. <TextBlock DockPanel.Dock="Top" Background="CornflowerBlue" x:Name="Message" />42. <telerik:RadTreeView x:Name="Tags" DockPanel.Dock="Bottom"43. ItemsSource="{Binding Path=Tags}"44. ItemTemplate="{StaticResource hierarchicalDataTemplate}"45. ItemContainerStyle="{StaticResource radTreeViewItemStyle}"46. 47. >48. <!--<telerik:RadTreeViewItem Name="Item" Header="Root"></telerik:RadTreeViewItem>-->49. <!--Background="#FFE2E8F2"-->50. <!--ItemsSource="{Binding Path=Tags}"-->51. <!--<telerik:RadTreeView.Items>52. <telerik:RadTreeViewItem Name="Item" Header="Root"></telerik:RadTreeViewItem>53. </telerik:RadTreeView.Items>-->54. 55. </telerik:RadTreeView>56. </DockPanel>57.</UserControl>
tagsViewModel.cs
01.using Caliburn.Micro;
02.using System;
03.using System.Collections.Generic;
04.using System.Collections.ObjectModel;
05.using System.Linq;
06.using System.Text;
07.using System.Threading.Tasks;
08.
09.namespace Notizen.ViewModels
10.{
11. public class TagsViewModel : Screen
12. {
13. private TagViewModel tag;
14.
15. public string Message { get; set; }
16.
17. public TagsViewModel()
18. {
19. Tags = new ObservableCollection<TagViewModel>();
20. }
21.
22. public TagViewModel RootTag
23. {
24. get
25. {
26. return this.tag;
27. }
28.
29. set
30. {
31. this.tag = value;
32. Tags.Add(value);
33. NotifyOfPropertyChange(()=> Tags);
34. }
35. }
36.
37. public ObservableCollection<TagViewModel> Tags
38. {
39. get;
40. set;
41. }
42. }
43.}
shellviewModel.cs
01.using System;
02.using Notizen.ViewModels;
03.using Notizen.Model;
04.using System.Linq;
05.using Caliburn.Micro;
06.using System.Collections.ObjectModel;
07.using System.ComponentModel.Composition;
08.
09.namespace Notizen {
10. [Export(typeof(IShell))]
11. public class ShellViewModel : Caliburn.Micro.PropertyChangedBase, IShell {
12.
13. private TagViewModel _tags;
14. public TagViewModel TagViewModel
15. {
16. get { return _tags; }
17. set {
18. if (_tags != value) return;
19. _tags = value;
20. NotifyOfPropertyChange(()=> TagViewModel);
21. }
22. }
23.
24. private string _helloText;
25.
26. public string HelloText
27. {
28. get { return _helloText; }
29. set { _helloText = value; }
30. }
31.
32. public TagsViewModel Tags { get; set; }
33.
34.
35. public ShellViewModel()
36. {
37. LoadTags();
38. HelloText = "Hello!";
39.
40. }
41.
42. private void LoadTags()
43. {
44. using (var context = new NotizenDbContext())
45. {
46. var roottag = context.Tags.Where(x => x.TagParentId == null).FirstOrDefault();
47.
48. //var tagViewModel = new TagViewModel(roottag, null);
49.
50. //TagViewModel = tagViewModel;
51.
52. Tags = new TagsViewModel() { Message = "Message from TestViewModel" , RootTag = tagViewModel };
53. }
54. }
55. }
56.}
Hi. I have an strange behaviour, but I cannot tell when did it happen. I just have a project with a view containing a radgridview, using implicit styles, but the group header is not shown. Whenever I put another radgridview in the same view without any attribute set, also the header is not shown, but it is shown if I am using it in a view of a new project without implicit styles.
Did anyone got this problem and found a solution?
Thanks.
David.
Can you please look into this issue
<Window x:Class="WpfApplication1.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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style x:Key="fieldStyle" TargetType="telerik:PropertyGridField" BasedOn="{StaticResource PropertyGridFieldStyle}">
<Setter Property="Background" Value="Red"/>
</Style>
</Window.Resources>
<Grid>
<telerik:RadPropertyGrid x:Name="PropertyGrid1" FieldStyle="{StaticResource fieldStyle}"/>
</Grid>
</Window>
Iam getting XAML Parse Exception when i tried to define style PropertyGridFieldStyle
Hello All,
I have a need to implement the ItemCreated event over in the ViewModel for a RadCombobox. I need an example of binding the event to a function. Does anyone know of an example out there??? In my View I have a RadComboBox that is bound to a List<string> in my ViewModel. In the contructor of the ViewModel, I populate this list. I need to handle the case when the user adds a new value to this ComboBox. I saw in the UI for Web docs a mention of the ItemCreated event. I think this is what 'm looking for, but don't have a clue as to how to go about implementing it in the WPF MVVM code. Any clues will be greatly appreciated!!!
Thanks in advance,
Kevin Orcutt
Senior Software Engineer
Wurth Electronics ICS, Inc.
7496 Webster St., Dayton, OH 45414
Tel: 937.415.7700
Toll Free: 877.690.2207
Fax: 937.415.7710
Email: Kevin.Orcutt@we-ics.com
http://www.we-ics.com
Hi,
I tried some animations in my WPF application. I need to have a Zoom in animation like given as attached ppt(link) example...
Is this kind of animation possible with Telerik? Please provide help in any cases that how I can be able to achieve this effect. Thanks in advance..
https://onedrive.live.com/redir?resid=61BC36F4F01D37D4!270&authkey=!AIBY84p-LlBmzw0&ithint=file%2cpptx
<telerik:RadComboBox Grid.Column="0" ItemsSource="{Binding Path=DropDownCollectionView}" IsSynchronizedWithCurrentItem="True" DisplayMemberPath="Code" IsEditable="True" EmptyText="Code" SelectedItem="{Binding Path=Container.Data, Mode=TwoWay}" Width="75" VerticalAlignment="Top"> <i:Interaction.Behaviors> <wpf:RadComboBoxClearTextOnLostFocusWhenSelectedItemIsNull /> </i:Interaction.Behaviors></telerik:RadComboBox>
For some reason after set Container.Data ComboBox Text has Object.ToString() value rather than the Object.Code property value however items of combobox dispay proper values.
public TData Data{ get { return _data; } set { if (_data == value) return; _data = value; RaisePropertyChanged(); }}public TContainer Container{ get { return _container; } private set { if (_container == value) return; _container = value; RaisePropertyChanged(); }}Hello,
I want to build a module with diagram,
in this module,I have two custom shape with textbox and button in the shape ContentTemplate.each shape provide 20 ToolboxItem,I want to achieve the goal when I input text to a textbox or click a button in the diagram,I want to get the text of the textbox or the which button was clicked.
the problem is:
1.in the diagram, there are 20 textbox/button ToolboxItem, how to binding a Property to the textbox/button let me know each textbox's text and which button was clicked.
2.can we binding a DependencyProperty to the textbox or button, and the mode is twoway?
I have looked the Dashboard simple,but I have no idea about this requirement.
Here is the pivotal code:
GenericShapes.xaml:
<Style TargetType="dashboard:TextBoxShape">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Width" Value="120" />
<Setter Property="Height" Value="40" />
<Setter Property="MaxWidth" Value="400" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<telerik:RadWatermarkTextBox MinWidth="90" MaxWidth="400" LostFocus="ChangeValue"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="dashboard:ButtonShape">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Width" Value="120" />
<Setter Property="Height" Value="40" />
<Setter Property="MaxWidth" Value="400" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Button></Button>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
ToolboxControl.xaml:
<local:TextBoxToolboxItem Header="t1" />
<local:TextBoxToolboxItem Header="t2" />
<local:ButtonToolboxItem Header="b1" />
<local:ButtonToolboxItem Header="b2" />
……
Hi,
I have some custom sorting for RadTreeView (ASC and DESC)...but I need the indicating arrows to go with them in my TextBlock above that triggers the sorting...Is that possible ? Any help is appreciated.
Barry
<TextBlock Text="{x:Static properties:Resources.GroupHeader}" MouseUp="TextBlock_MouseUp" TextAlignment="Center" Style="{StaticResource HeaderTemplate}" HorizontalAlignment="Stretch"/>
//GROUP CUSTOM SEARCH
private void TextBlock_MouseUp(object sender, MouseButtonEventArgs e)
{
isoProvider.LoadFromStorage(groupTreeViewIsolatedStorage); //GET
IEnumerable<GroupVM> groups = GroupTree.ItemsSource as IEnumerable<GroupVM>;
if (GroupTreeViewOrdering.Content.Equals(ConstantsUnit.Key_SortAscending))
{
IEnumerable<GroupVM> test = groups.OrderByDescending(p => p.Name);
GroupTree.ItemsSource = null;
while (GroupTree.ItemsSource == null) {
GroupTree.ItemsSource = test;
}
//GroupTree.ItemsSource = groups.OrderByDescending(p => p.Name);
GroupTreeViewOrdering.Content = ConstantsUnit.Key_SortDescending;
}
else if (GroupTreeViewOrdering.Content.Equals(ConstantsUnit.Key_SortDescending))
{
IEnumerable<GroupVM> test = groups.OrderBy(p => p.Name);
GroupTree.ItemsSource = null;
while (GroupTree.ItemsSource == null) {
GroupTree.ItemsSource = test;
}
//GroupTree.ItemsSource = groups.OrderBy(p => p.Name);
GroupTreeViewOrdering.Content = ConstantsUnit.Key_SortAscending;
}
isoProvider.SaveToStorage(groupTreeViewIsolatedStorage); //SET
}
Hello,
We're having some issues with the Telerik RadPDFViewer not printing correctly. When we were on the UI for WPF version 2016.1.112 the print worked fine. Now that we are on the new version 2016.2.503 the print isn't working as intended.
The problem is if you have a multi page PDF in the PDFViewer and try and print it.
The PDF is converted to a byte array (to save to the database), then made into a MemoryStream, and then is passed to the PDFViewer. When you run the PDFViewer.Print() function it will send the PDF to the printer, but data only actually is printed on the first page and the following pages are just blank pages. The printer spits out the correct number of pages that are in the PDF but the first page is the only one that actually has something on it.
The reason we take the PDF and convert it to a byte array is because it's saved to the database for record and display later. This allows a user can come back later on and load the PDF that was saved to the database. It's loaded in from the database into a MemoryStream then to the PDFViewer.
I can provide a sample project that demonstrates the issue we are experiencing and how we are converting everything around. I would attach it but it wouldn't let me.
Telerik UI for WPF version: 2016.2.503 - May 03,2016
.Net Framework version: 4.0
Thanks in advance,
Kevin