Telerik Forums
UI for WPF Forum
3 answers
275 views

Hi, I use the following code to overwrite the FilteringControl

public class ContainsFilteringControl: FilteringControl
    {
        public override void Prepare(GridViewColumn gridViewColumn)
        {
            base.Prepare(gridViewColumn);
  
            var vm = DataContext as FilteringViewModel;
  
            if (vm == null) return;
              
            if (!vm.Filter1.IsActive)
            {
                vm.Filter1.Operator = FilterOperator.Contains;
            }
  
            if (!vm.Filter2.IsActive)
            {
                vm.Filter2.Operator = FilterOperator.Contains;
            }
        }
  
    }

Then, in the code behind of the view,

public MyWindow(MyViewModel viewModel)
{
      DataContext = viewModel;
      this.radGrid.Columns[2].FilteringControl = new ContainsFilteringControl();
 }

After recompile and run the application, the filter changes to Contains.

However, when the filter is opened first time, the text boxes below the filter dropdowns are not shown.

When the filter window is opended the second time, the text boxes will appear.

Anything I can do to fix this?

Thanks
Rossen Hristov
Telerik team
 answered on 27 Nov 2012
1 answer
121 views
hi
i implement  Radtoolbar with basic functions but only copy undo and  cut commands are working . the others editingcommans and applicationcommand arn't working  sush as EditingCommands.DecreaseFontSize or increase
could you give me an example to implement it.
thanks by advance
Pavel R. Pavlov
Telerik team
 answered on 27 Nov 2012
4 answers
148 views
Hello,

I'm using internal build 2012.3.1017.40 and it seems the GridView is using the wrong locale (en-US instead of de-DE) when DataFormatString is applied to cells. Currency values are formatted as "$100.00" instead of "100,00 €". Is there a new configuration I have to set up or is it an issue with this build? I need to use the internal build because I'm using the WPF ReportViewer as well and there is that mean printing bug in the main release.

Kind regards
Markus
Markus Wolff
Top achievements
Rank 1
 answered on 27 Nov 2012
1 answer
371 views
I came across the need to be able to sort my ObservableCollections the other day and I found a nice code snippet demonstrating how to sort an ObservableCollection even if the collection type does not support IComparable. I added the ReverseCompare/Descending sort just in case. Anyhow thought it was a neat piece of code and hope it may help some others out there.

Enjoy!

public static class CollectionSorter  
    {  
        public static void Sort<T>(this ObservableCollection<T> collection, Comparison<T> comparison)  
        {  
            var comparer = new Comparer<T>(comparison);  
 
            List<T> sorted = collection.OrderBy(x => x, comparer).ToList();  
 
            for (int i = 0; i < sorted.Count(); i++)  
                collection.Move(collection.IndexOf(sorted[i]), i);  
        }  
 
        public static void DescendingSort<T>(this ObservableCollection<T> collection, Comparison<T> comparison)  
        {  
            var comparer = new ReverseComparer<T>(comparison);  
 
            List<T> sorted = collection.OrderBy(x => x, comparer).ToList();  
 
            for (int i = 0; i < sorted.Count(); i++)  
                collection.Move(collection.IndexOf(sorted[i]), i);  
        }       
    }  
 
    internal class Comparer<T> : IComparer<T>  
    {  
        private readonly Comparison<T> comparison;  
 
        public Comparer(Comparison<T> comparison)  
        {  
            this.comparison = comparison;  
        }
        #region IComparer<T> Members  
 
        public int Compare(T x, T y)  
        {  
            return comparison.Invoke(x, y);  
        }
        #endregion  
    }  
 
    internal class ReverseComparer<T> : IComparer<T>  
    {  
        private readonly Comparison<T> comparison;  
 
        public ReverseComparer(Comparison<T> comparison)  
        {  
            this.comparison = comparison;  
        }
        #region IComparer<T> Members  
 
        public int Compare(T x, T y)  
        {  
            return -comparison.Invoke(x, y);  
        }
        #endregion  
    } 

then you can use it on your ObservableCollections as such. 
private void Log(LogEntry log)  
        {  
            LoggedEvents.Add(log);  
            LoggedEvents.DescendingSort((x, y) => x.TimeStampString.CompareTo(y.TimeStampString));  
        }        
 
        private ObservableCollection<LogEntry> entries = new ObservableCollection<LogEntry>();  
        public ObservableCollection<LogEntry> LoggedEvents  
        {  
            get 
            {                  
                return entries;  
            }  
            set 
            {  
                entries = value;  
                RaisePropertyChanged(LoggedProperty);  
            }  
        } 
Jonas
Top achievements
Rank 1
 answered on 27 Nov 2012
1 answer
196 views
How to disable row edit mode? Leave only insert and delete.
Yoan
Telerik team
 answered on 27 Nov 2012
1 answer
209 views
Hi,

If the vertical scrollbar is used to scroll the list of dropdown items and then whilst the drop down is still displayed the applications main window is moved, the dropdown panel remains at it's former position and does not follow the location of the autocomplete edit box.

Is there a way to control this so that it either moves with the form or closes before the form is moved in the same way that a combobox would?

Attached screenshot illustrates the problem when using the WPF demo controls application.

Rgds
Graeme
Alek
Telerik team
 answered on 27 Nov 2012
0 answers
52 views
HI ,

i am using trail version of Test studio and i want to display the value of a variable. To display the value in C# we will use "MessageBox.Show("Value of the variable")". when i use this method i am getting one error message as namespace is not added as a hedder files, but i am not able to see in the list namesapces because i have not added repective *.dll files. can any one please let me know about adding of *.dll files.

Thanks
satyanarayana
S
Top achievements
Rank 1
 asked on 27 Nov 2012
2 answers
206 views
Hello,

We are using version 2012.2.607.40 of your WPF controls.  Our application supports several font sizes so we updated many Telerik styles and templates for the PropertyGrid to use the dynamic font size. Our changes worked for the property names (they all show the correct size now), but some of the values do not.  We do not see where the value templates are so that we can change them.

How can we get to the right templates for the PropertyGrid values so we can change them to use our dynamic size -for all the value types used in the property grid? Or, is there another way to accomplish this?  I've attached a picture so you can visualize the problem.  You can see some of the values have the larger size but others do not. 

Thanks!
-Mark
mark
Top achievements
Rank 1
 answered on 27 Nov 2012
2 answers
122 views
When I run my program with debug then everything works normal, but whenever I run without debug or from the exe it dosn't display anything.  Actually it tells me it is empty when I have already added the controls in xaml, they are static not dynamic at all.  It still says all my controls exist and I can use them but they not displayed at all.  This used to work but I made not changes that would break it.  I do however toggle it's visibility but even when I have it always visible it dosn't work.  It's like it is not seeing anything under the RadDocking tag.

<telerik:RadDocking Background="#edf3fa"  x:Name="dmManager" Grid.Row="1" Margin="0,0,0,33" Padding="0,0,0,0">
            <telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer>
                    <telerik:RadPaneGroup>
                    (Assume controls)
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking.DocumentHost>
 
            <telerik:RadSplitContainer InitialPosition="DockedLeft">
                <telerik:RadPaneGroup>
                    (Assume controls)
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
 
            <telerik:RadSplitContainer InitialPosition="DockedRight">
                <telerik:RadPaneGroup>
                    (Assume controls)
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
 
            <telerik:RadSplitContainer x:Name="Bottom"  InitialPosition="DockedBottom">
                <telerik:RadPaneGroup>
                    (Assume controls)
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking>
Alex
Top achievements
Rank 1
 answered on 26 Nov 2012
1 answer
224 views
What is the proper way of coding standard to bind the ObservableCollection to ItemSource?
The case i'm facing is i have multiple lineseries, therefore, i created an ObservableCollection<IEnumberable><T>> that contains array of ObservableCollection<T>. i make the ObservableCollection<IEnumberable><T>> binded to the itemsource of lineSeries with INotifyPropertyChanged.

Code Snippet:
XAML:
<chartView:LineSeries x:Name="Item1" ItemsSource="{Binding Item[0]}" ValueBinding="Value" CategoryBinding="Counter" />
<chartView:LineSeries x:Name="Item2" ItemsSource="{Binding Item[1]}" ValueBinding="Value" CategoryBinding="Counter" />
<chartView:LineSeries x:Name="Item3" ItemsSource="{Binding Item[2]}" ValueBinding="Value" CategoryBinding="Counter" />
<chartView:LineSeries x:Name="Item4" ItemsSource="{Binding Item[3]}" ValueBinding="Value" CategoryBinding="Counter" />
<chartView:LineSeries x:Name="Item5" ItemsSource="{Binding Item[4]}" ValueBinding="Value" CategoryBinding="Counter" />

C#
public ObservableCollection<IEnumerable<GraphPlot>> Item
{
      get { return m_item; }
      set
      {
           m_item = value;
           OnPropertyChanged("Item");
      }
}

i have an error "observablecollection collection was modified enumeration operation may not execute" using the code above.
is this the right way to bind it to multiple itemsource with only 1 Properties at real-time? any recommendation?

Petar Kirov
Telerik team
 answered on 26 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?