Telerik Forums
UI for WPF Forum
1 answer
610 views
I have a toolbar with a button that executes a command. When the command is executed, I set a property from code behind:
SetValue(IsRunningProperty, true);

A worker thread does some work, and when completed the property is updated again:
SetValue(IsRunningProperty, false);

The toolbar binds to this property as follows:
<telerik:RadButton Margin="2" Command="{StaticResource Commands.Run}" IsEnabled="{Binding IsRunning, Converter={StaticResource InverseBooleanConverter}}">
  <Image Stretch="None" Source="..." />
</telerik:RadButton>

This works as long as the toolbar is not focused. If I press the button and wait for my worker to complete, the button will remain disabled until I click in my RadDiagram.

Why isn't the toolbar updating immediately?

UPDATE: Ok, it seems this is caused by a call to someOtherWindow.Focus(). Still, why doesn't the toolbar update itself?
Petar Mladenov
Telerik team
 answered on 10 Apr 2013
3 answers
152 views
I am trying to create a universal Behavior for my application for DragNDrop using your infrastructure.

I would like to bind an items datacontext to a property of my DragDropBehavior but your abstract class inherits from DependencyObject instead of FrameworkElement so it doesn't work.

Can you change this class:
public abstract class DragDropBehavior<TState> : DependencyObject, IDragDropBehavior<TState> where TState : DragDropState

To this in the future:
public abstract class DragDropBehavior<TState> : FrameworkElement, IDragDropBehavior<TState> where TState : DragDropState
Nick
Telerik team
 answered on 10 Apr 2013
1 answer
233 views
I have this situation! I have a MVVM application and the code for the tree:
<telerik:RadTreeView
    IsExpandOnSingleClickEnabled="True"
    ItemsSource="{Binding DLYReasons, Mode=TwoWay}"
    SelectedItem ="{Binding SelectedTreeItem, Mode=TwoWay}">
    <telerik:RadTreeView.ItemContainerStyle>
        <Style TargetType="{x:Type telerik:RadTreeViewItem}">
            <Setter Property="FontWeight" Value="Normal" />
        </Style>
    </telerik:RadTreeView.ItemContainerStyle>
 
    <telerik:RadTreeView.ItemTemplate>
        <HierarchicalDataTemplate ItemsSource="{Binding ChildElements}">
            <StackPanel Orientation="Horizontal">
                <Border MaxHeight="20" MaxWidth="20" MinHeight="20" MinWidth="20"
                        Background="{Binding ImageResourceId, Converter={StaticResource valueToStaticResource}, ConverterParameter={StaticResource StaticResourceValuesTreeShape}}"/>
                <Label Content="{Binding ReasonCode}"></Label>
            </StackPanel>
        </HierarchicalDataTemplate>
    </telerik:RadTreeView.ItemTemplate>
</telerik:RadTreeView>


When I refresh the tree I want to select the previous item and expand it downto the level where this item resides.

Luka 
Pavel R. Pavlov
Telerik team
 answered on 10 Apr 2013
3 answers
219 views
Hi,

First, let me say that the RadDataForm is a great control, i love it, i need only this bit to make it perfect for me:

I am trying to template the DataFormComboBoxField and DataFormDataField. I want them to look in Disabled mode like they look in Edit mode, for example, i want the Combobox 100% opacity but only the triangle will be light grey, and the textboxes will have the border.

I have 2 problems, the first one :
for some reason i cannot get to the nested DataFormComboBoxField and DataFormDataField in Blend, so i cant edit them.

the second problem:
i tried to achieve the above look with RadComboBox, i edited the ChromeButton and some parts of the style and it worked well, but my app using the Windows8 theme, and the edited style using the default office black theme, i saw in the documentation that i should:
"....manually copy the style, together with all resources it has a reference to, from RadControls installation folder on your machine. This folder contains a Themes folder in which you can find resources for RadComboBox or any other control according to the theme you use...."

 - sorry, but i couldn't find a way to make it work.

i spent a ridiculous  amount of time on it, so a step-by-step will be appreciated. BTW, i am sure i am not the only one that asking for this look of the controls, i think it really should be included in the controls.

Thanks. M.

  
Maya
Telerik team
 answered on 10 Apr 2013
1 answer
206 views
Hi,

What is the best practices for the following situation?

1) I have a MainWindow / Menu / MenuItemA
    I click MenuItem and want another window to display say [EditWindow].

2) from [EditWindow] i want to click /Contextmenu/MenuItemB and open yet another form [AnotherEditWindow]

Does Telerik provide some type of messaging system, mediator pattern?

How should this be coded to MVVM standards, I've read the MenuItemB.Command executes on MainWIndowViewModel, raising an event that
MainWIndow has subscribed too. In code behind i create EditWIndow.

Same for EditWindow, MenuItemB.Command executes on EditWindowViewModel, raising an event that EditWindow has subscribed too, and creates AnotherEditWindow.

OR.

just use routedEvents to code behind and create new windows like Winforms development?

OR

Use some framework?

Thanks
Gary


Ivo
Telerik team
 answered on 10 Apr 2013
1 answer
64 views
In the release 2013Q1sp1, I have a serious binding exception when code change a binding property value. it because I send property changed event in a back work thread, and control may not handle invoke requirement and correct work in cross thread status. In older version ,everything is ok, so in 2013Q1sp1 must do some changes.
I use a demo project and change some code to show this issue, the project can work well in 2013Q1, but have exception in 2013Q1sp1

MainWindow.xaml:

 

<Window x:Class="RadControlsWpfApp17.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="350" Width="525">
        <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <telerik:RadToolBar>
            <Button Command="{Binding ChangeCommand}" Content="Change Begin" Height="24" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Top" Width="81" />
        </telerik:RadToolBar>
        <telerik:RadGridView ItemsSource="{Binding Data}" GroupRenderMode="Flat"
                             AutoGenerateColumns="False"
                             CanUserFreezeColumns="False"
                             RowIndicatorVisibility="Collapsed"
                             IsFilteringAllowed="False"  Grid.Row="1">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Change, StringFormat=f4}"
                                             />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding LastUpdate}"
                                            Header="Last Update" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>

MainWindow.xaml.cs
using System.Windows;
  
namespace RadControlsWpfApp17
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = new TestDataContext();
        }
    }
}

TestDataContext.cs

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Timers;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
  
namespace RadControlsWpfApp17
{
    class TestDataContext
    {
        readonly string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        Random rnd = new Random();
  
        public DelegateCommand ChangeCommand
        {
            get
            {
                return new DelegateCommand((o)=>
                    {
                        Task.Factory.StartNew(() =>
                        {
                            System.Timers.Timer t=new Timer();
                            t.Interval = 100;
                            t.Elapsed += new ElapsedEventHandler((sender, e) =>
                                {
                                    int index = this.rnd.Next(0, this.Source.Count());
                                    StockData item = this.CreateNewStockItem();
                                    this.Source[index].Name = e.SignalTime.ToString();
                                });
                            t.Start();
                        });
                    });
            }
        }
  
        ObservableCollection<StockData> source;
        ObservableCollection<StockData> Source
        {
            get
            {
                if (this.source == null)
                {
                    this.source = new ObservableCollection<StockData>(from i in Enumerable.Range(0, 50) select this.CreateNewStockItem());
  
                }
  
                return this.source;
            }
        }
  
        private StockData CreateNewStockItem()
        {
            var item = new StockData();
            this.SetRandomPropertyValues(item);
            return item;
        }
  
        private void SetRandomPropertyValues(StockData item)
        {
            item.Name = String.Format("{0}{1}{2}{3}", this.letters[this.rnd.Next(0, this.letters.Count())], this.letters[this.rnd.Next(0, this.letters.Count())],
                this.letters[this.rnd.Next(0, this.letters.Count())], this.letters[this.rnd.Next(0, this.letters.Count())]);
            item.LastUpdate = DateTime.Now;
            item.Change = this.rnd.NextDouble();
        }
  
        QueryableCollectionView data;
        public QueryableCollectionView Data
        {
            get
            {
                if (this.data == null)
                {
                    this.data = new QueryableCollectionView(Source);
                    this.data.SortDescriptors.Add(new SortDescriptor()
                    {
                        Member = "Name",
                        SortDirection = System.ComponentModel.ListSortDirection.Descending
                    });
                }
  
                return this.data;
            }
        }
    }
    public class StockData : INotifyPropertyChanged
    {
        private string name;
        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                if (this.name != value)
                {
                    this.name = value;
                    this.OnPropertyChanged("Name");
                }
            }
        }
  
        private double change;
        public double Change
        {
            get
            {
                return this.change;
            }
            set
            {
                if (this.change != value)
                {
                    this.change = value;
                    this.OnPropertyChanged("Change");
                }
            }
        }
  
        private DateTime lastUpdate;
        public DateTime LastUpdate
        {
            get
            {
                return this.lastUpdate;
            }
            set
            {
                if (this.lastUpdate != value)
                {
                    this.lastUpdate = value;
                    this.OnPropertyChanged("LastUpdate");
                }
            }
        }
  
        private void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
  
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
Vlad
Telerik team
 answered on 10 Apr 2013
1 answer
99 views
Hi,

I need to set the RadContextMenu to FrameworkContentElement such as GridViewDataColumn.
I can set contextmenu to FrameworkElement only!!


Thanks,
Akram
Rosen Vladimirov
Telerik team
 answered on 10 Apr 2013
0 answers
141 views
Hi guys,

like the title already tells i use a RibbonView with a Backstage as menu.

There i add a item and set the icon property to a 16x16 png.
The problem is that the icon does not be displayed in the right way, something cuts my image.

And as far as I know the MaxWidth and MaxHeight is set to 16 for these icons. So why my 16x16 image is not displayed right?

Here is the code of my item:
<telerik:RadRibbonBackstageItem Command="{Binding CloseCommand}"
                      Header="Close"
                      Icon="/MyApp.Client.Infrastructure;component/Resources/Images/16/close.png"
                      IsSelectable="False" />

Please find attach a picture showing the result and the orignial image.

Can anybody help me?
Mark
Top achievements
Rank 1
 asked on 10 Apr 2013
2 answers
1.2K+ views

        private void DataGrid_KeyDown(object sender, KeyEventArgs e)
        {
            // subroutine has its own error handling
            try
            {
                GridViewCell cell;

                // get the current cell, if any
                cell = DataGrid.CurrentCell;
                if (cell != null)
                {
                    // if the current cell is in the CODE column...
                    if (cell.Column.Header.ToString().ToUpper() == "CODE")
                    {
                        // set any textboxes to force upper case
                        IList<TextBox> txtList = cell.ChildrenOfType<TextBox>();
                        foreach (TextBox txt in txtList)
                        {
                            txt.CharacterCasing = CharacterCasing.Upper;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                w.MessageInternal("DataGrid_KeyDown: " + ex.ToString());
            }
        }

danparker276
Top achievements
Rank 2
 answered on 09 Apr 2013
1 answer
167 views
We were VERY excited to see Telerik come out with a way to deploy the RadControls for WPF libraries via NuGet so we anxiously made the switch and, in the process, upgraded from 2012.Q3 to 2013.Q1.  Unfortunately, in doing so, all of the RadGridView controls we had in our UI suddenly stopped appearing in the UI.

Since I didn't actually do the work, and the person that did is no longer with the company, I'm not sure the specifics why we overrode the entire control template for the grid (I think it had to do with restyling some aspect of the control that you can only get to by replacing the template).  According the dev's notes, the template was provided by Telerik for the 2012.Q1 release and he only modified the colors applied to various parts to fit our branding.  The template did have references to the MetroTheme which no longer exists in 2013.Q1 so we had to change that to the Windows8Theme (the only changes we made to any of our styles, templates, etc.).

When we run the application, I can see that the grid is there because the vertical scroll bar will appear but nothing else is displayed.  I verified that the problem is not due to the foreground and background colors being the same by changing the background of the parent control.  There is literally NOTHING displayed.

We also make use of several other Telerik controls, including a couple with custom templates, and none of them are having any issues.

What has changed in the new version that has broken our apps?  What should I be looking for/at to get the control working again?
Vera
Telerik team
 answered on 09 Apr 2013
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?