or
this.AssociatedObject.TopContainer.MouseEnter += new MouseEventHandler(TopContainer_MouseEnter);
<Window x:Class="CarouselTest2.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:local="clr-namespace:CarouselTest2" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <DataTemplate DataType="{x:Type local:Item}"> <Border BorderBrush="Black" BorderThickness="2" CornerRadius="5"> <Grid> <Label Content="{Binding Path=Value}" /> </Grid> </Border> </DataTemplate> </Window.Resources> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <TextBox x:Name="txtBox" Grid.Row="0" TextChanged="TextBox_TextChanged" /> <telerik:RadCarousel x:Name="Carousel" Grid.Row="1" Focusable="False" AutoGenerateDataPresenters="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible"> <telerik:RadCarousel.ItemsPanel> <ItemsPanelTemplate> <telerik:RadCarouselPanel ItemsPerPage="7" IsOpacityEnabled="False" PathPadding="0"> <!--<telerik:RadCarouselPanel.Path> <Path Stretch="Fill"> <Path.Data> <LineGeometry StartPoint="0, 800" EndPoint="0, 10" /> </Path.Data> </Path> </telerik:RadCarouselPanel.Path>--> </telerik:RadCarouselPanel> </ItemsPanelTemplate> </telerik:RadCarousel.ItemsPanel> </telerik:RadCarousel> </Grid></Window>using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.Collections;namespace CarouselTest2{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { ListCollectionView view; public MainWindow() { InitializeComponent(); List<Item> Items = new List<Item>(); for (int i = 0; i < 150; i++) { Items.Add(new Item(i)); } view = new ListCollectionView(Items.ToList()); view.Filter = new Predicate<object>(FilterObject); this.Carousel.ItemsSource = view; } private bool FilterObject(object itemToFilter) { if (itemToFilter == null) return false; String filterText = this.txtBox.Text.ToUpper(); if (filterText.Length == 0) return true; return ((itemToFilter as Item).Value.ToString().Contains(filterText)); } private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { this.view.Refresh(); this.Carousel.BringDataItemIntoView(this.view.CurrentItem); } } public class Item { public Item(int i) { this.Value = i; } public int Value { get; set; } }}<telerik:GridViewDataColumn DataMemberBinding="{Binding Period}" Header="Period"> <telerik:GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding PeriodFormatted}" /> </DataTemplate> </telerik:GridViewColumn.CellTemplate> <telerik:GridViewColumn.CellEditTemplate> <DataTemplate> <TextBox Text="{Binding Path=PeriodFormatted, Mode=TwoWay}" /> </DataTemplate> </telerik:GridViewColumn.CellEditTemplate> </telerik:GridViewDataColumn>public string PeriodFormatted { get { return Period.PeriodToString(); } set { Period = value.StringToPeriod(ContractHeader.Date); SendPropertyChanged("PeriodFormatted"); } }My code:
MainWindow.xaml
<Window x:Class="TestStyle.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" Title="MainWindow" Height="350" Width="525"> <StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <telerik:RadButton Width="150" Content="Add new row" Command="telerikGrid:RadGridViewCommands.BeginInsert" CommandTarget="{Binding ElementName=RadGridView1}" /> </StackPanel> <telerikGrid:RadGridView SelectionMode="Single" AddingNewDataItem="RadGridView1_AddingNewDataItem" x:Name="RadGridView1" AutoGenerateColumns="False"> <telerikGrid:RadGridView.Columns> <telerikGrid:GridViewComboBoxColumn Header="Screen" UniqueName="Screen" x:Name="screen" DataMemberBinding="{Binding IdGrid}" DisplayMemberPath="Name" SelectedValueMemberPath="IdListBox" > <telerikGrid:GridViewComboBoxColumn.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Name}" x:Name="textblockTooltip" Width="Auto" Padding="1,1,1,1" > <TextBlock.ToolTip> <ToolTip> <ToolTip.Template> <ControlTemplate TargetType="ToolTip"> <Border CornerRadius="2,2,2,2" Width="100" Height="75" x:Name="borderTooltip" Background="Green" BorderBrush="#FF000000" Margin="2"> <ContentPresenter Content="{Binding GridView}" Margin="2" /> </Border> </ControlTemplate> </ToolTip.Template> </ToolTip> </TextBlock.ToolTip> </TextBlock> </StackPanel> </DataTemplate> </telerikGrid:GridViewComboBoxColumn.ItemTemplate> </telerikGrid:GridViewComboBoxColumn> </telerikGrid:RadGridView.Columns> </telerikGrid:RadGridView> </StackPanel> </Window> MainWindow.xaml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Collections.ObjectModel; using Telerik.Windows.Controls; namespace TestStyle { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { bool resolution = false; public bool Resolution { get { return resolution; } set { resolution = value; } } public MainWindow() { InitializeComponent(); ICommand beginInsertCommand = RadGridViewCommands.BeginInsert; ObservableCollection<ItemGrid> collectionGrid = new ObservableCollection<ItemGrid>(); RadGridView1.ItemsSource = collectionGrid; ObservableCollection<ItemListBox> collectionListBox = new ObservableCollection<ItemListBox>(); Label l1 = new Label(); l1.Content = "Label 1"; Label l2 = new Label(); l2.Content = "Label 2"; Grid gr1 = new Grid(); gr1.Children.Add(l1); Grid gr2 = new Grid(); gr2.Children.Add(l2); collectionListBox.Add(new ItemListBox(1, "Name 1", gr1)); collectionListBox.Add(new ItemListBox(2, "Name 2", gr2)); screen.ItemsSource = collectionListBox; } private void RadGridView1_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e) { e.NewObject = new ItemGrid(0); } } } ItemGrid.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Controls; using System.ComponentModel; namespace TestStyle { class ItemGrid : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private int idGrid; public int IdGrid { get { return idGrid; } set { idGrid = value; NotifyPropertyChanged("IdGrid"); } } public ItemGrid(int id) { this.idGrid = id; } private void NotifyPropertyChanged(string info) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(info)); } } } ItemListBox.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Controls; using System.ComponentModel; namespace TestStyle { class ItemListBox : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; int idListBox; public int IdListBox { get { return idListBox; } set { idListBox = value; NotifyPropertyChanged("IdListBox"); } } string name; public string Name { get { return name; } set { name = value; NotifyPropertyChanged("Name"); } } Grid gridView; public Grid GridView { get { return gridView; } set { gridView = value; NotifyPropertyChanged("GridView"); } } public ItemListBox(int idListBox, string name, Grid gridView) { this.idListBox = idListBox; this.gridView = gridView; this.name = name; } private void NotifyPropertyChanged(string info) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(info)); } } }I need to change Height property at Border "borderTooltip" according to value of property Resolution in ManWindow.xaml.cs.
I tried in constructor MainWindow() this:
if (Resolution == true) borderTooltip.Height = 75; else borderTooltip.Height = 50;But i can´t access borderTooltip in code.Does somebody know please how to change borderTooltip.Height according to value of Resolution property?