Telerik Forums
UI for WPF Forum
2 answers
384 views
I have a WPF application that I am validating ComboBox and TextBox controls using custom Validation classes in XAML.
The following is my ComboBox and it is a required field.  I have not found any examples of similar code for validation using RadComboBox. 
<ComboBox Width="225" VerticalAlignment="Center" IsEditable="True" IsReadOnly="False">
   <ComboBox.ItemTemplate>
      <DataTemplate>
         <TextBlock Text="{Binding}" />
      </DataTemplate>
   </ComboBox.ItemTemplate>
   <ComboBox.Text>
      <Binding Path="Name" UpdateSourceTrigger="LostFocus"
               NotifyOnValidationError="True"
               NotifyOnSourceUpdated="True"
               NotifyOnTargetUpdated="True">
          <Binding.ValidationRules>
             <Validator:RequiredFieldRule FieldName="Field Name Prompt" />
          </Binding.ValidationRules>
       </Binding>
    </ComboBox.Text>
</ComboBox>
Here is my Window.Resources code to display the validation error message:
<Style TargetType="ComboBox">
    <Setter Property="VerticalAlignment" Value="Center" />
    <Style.Triggers>
        <Trigger Property="Validation.HasError" Value="true">
            <Setter Property="ToolTip"
                    Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                            Path=(Validation.Errors).CurrentItem.ErrorContent}" />
RequiredFieldRule is a class in my application derived from ValidationRule.




When I replace 'ComboBox' with ' RadComboBox' the Style used to set the ToolTip with the error message does not work. 
Any help would be greatly appreciated.


Kevin Y
Top achievements
Rank 1
 answered on 26 Oct 2010
9 answers
210 views
Hi there,

I try to syncronisize the Grid with one Textbox. Everytime I click on a other cell, the Textbox should show the value of the cell. Now when I change the value of the cell, the text in the Textbox have to change too. (Like MS-Excel do)
The datasource of the Grid is a DataTable and dependending to this DataTable the Grids Rows and Columns where build by Runtime. The Datatable will get his Data from various Textfiles so it should be different each time its loaded.

I hope someone understand what I want to say and can help me.
Andi
Top achievements
Rank 2
 answered on 26 Oct 2010
1 answer
157 views

Hello!

Now I testing a trial version of RadControls, and I have one issue:

I trying to create RadGridView with 40+ columns, with binds to ObservableCollection<>.

When I start my application, I can see the horizontal scrollbar, but not all of my columns are visible. If I will make several random clicks on RadGridView component, scrollbar width increases, and all columns became visible. What I do wrong?

1.<Grid>
2.        <telerik:RadGridView Name="dataGrid1"
3.                            EnableColumnVirtualization="True"
4.                             EnableRowVirtualization="True"
5.                             DataLoadMode="Asynchronous"
6.                             />
7.</Grid>

01.public partial class MainWindow : Window
02.    {
03.        /// <summary>
04.        /// Here is sample data class with a lot of fields
05.        /// </summary>
06.        class MyDataClass
07.        {
08.            public bool IsChecked { get; set; }
09.            public int Number { get; set; }
10.            public int Num43ber { get; set; }
11.            public int Num4ber { get; set; }
12.            public int Nu543mber { get; set; }
13.            public int Num45ber { get; set; }
14.            public int Nu5343mber { get; set; }
15.            public int Num435ber { get; set; }
16.            public int Num4vd5ber { get; set; }
17.            public int Nu543sdmber { get; set; }
18.            public int Num4sd5ber { get; set; }
19.            public int Nu43mber { get; set; }
20.            public int Num4fsdf35ber { get; set; }
21.            public int Nu54fds3vmber { get; set; }
22.            public int Nu52435mber { get; set; }
23.            public int Num43dsad5ber { get; set; }
24.            public int Num5435ber { get; set; }
25.            public int Nu4532mber { get; set; }
26.            public int Nu45mber { get; set; }
27.            public int f5344 { get; set; }
28.            public int Nufdmber { get; set; }
29.            public int Nu3fg45mber { get; set; }
30.            public int Nu52dfg435mber { get; set; }
31.            public int Numfdg43dsad5ber { get; set; }
32.            public int Numfdg5435ber { get; set; }
33.            public int Nudfg4532mber { get; set; }
34.            public int Nu4fdg5mber { get; set; }
35.            public int f53fdg44 { get; set; }
36.            public int Nufgfdmber { get; set; }
37.            public int Nufgdf345mber { get; set; }
38.            //
39.            public int Nufds45mber { get; set; }
40.            public int f5dsf344 { get; set; }
41.            public int Nasdfufdmber { get; set; }
42.            public int Nadsfu3fg45mber { get; set; }
43.            public int Nudasf52dfg435mber { get; set; }
44.            public int Nasdfumfdg43dsad5ber { get; set; }
45.            public int Nudsafmfdg5435ber { get; set; }
46.            public int Nuadsfdfg4532mber { get; set; }
47.            public int Nudsf4fdg5mber { get; set; }
48.            public int f5dsaf3fdg44 { get; set; }
49.            public int Nuadffgfdmber { get; set; }
50.            public int LASTCOLUMN { get; set; }
51.        }
52.  
53.        // here is sample collection
54.        ObservableCollection<MyDataClass> list;
55.        public MainWindow()
56.        {
57.            InitializeComponent();
58.            list = new ObservableCollection<MyDataClass>();
59.            // fill the collection with some elements
60.            for (int i = 0; i < 50; i++)
61.                list.Add(new MyDataClass() { IsChecked = true, Number= i });
62.            // bind it to RadGridView
63.            dataGrid1.ItemsSource = list;
64.        }
65.    }

Thanks. And sorry for my bad english, please :(.

Pavel Pavlov
Telerik team
 answered on 26 Oct 2010
1 answer
69 views

Hello,

Here is my question.

We have the GridView, and some columns are bound to the List<MyType>.We've made a custom filter like shown in some of your. demos. Now we need to filter those columns, but the DataMemberBinding is set to the List. Some code:

01.<DataTemplate x:Key="cellTemplate">
02. <DataTemplate.Resources>
03.  <my:PercentsConverter  x:Key="PerConv">
04. </DataTemplate.Resources>
05. <TextBlock>
06.  <TextBlock.Text>
07.   <MultiBinding Converter ="{StaticResource PerConv}" 
08.                 ConverterParameter="MyParam">
09.    <Binding Path="ListValues"/>
10.    <Binding Path="SomeValues"/>
11.   </MultiBinding>
12.  </TextBlock.Text>
13. </TextBlock>
14.</DataTemplate>

01.var tCol = new GridViewDataColumn()
02.{
03.     Header = temp.ToString(),
04.     CellTemplate = datatemplate,
05.     CellStyleSelector = new CellStyleSelector(),
06.     DataMemberBinding = new Binding("ListValues"),
07.     IsFilterable = true,
08.     FilteringControl = new Filtering()
09.     {
10.         Minimum = 0,
11.         Maximum = 100
12.     },
13.};
When we start the program there is no filter at these columns at all.

Veselin Vasilev
Telerik team
 answered on 26 Oct 2010
3 answers
545 views
Type reference cannot find type named '{clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls}TransparentTheme'.
   at MS.Internal.Xaml.Context.ObjectWriterContext.ServiceProvider_Resolve(String qName)
   at MS.Internal.Xaml.ServiceProviderContext.System.Windows.Markup.IXamlTypeResolver.Resolve(String qName)
   at System.Windows.Markup.TypeTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at System.Windows.Baml2006.TypeConverterMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
Konstantina
Telerik team
 answered on 26 Oct 2010
1 answer
234 views
Hi..
I have a button that adds a new row to the grid. I need to set focus to the new row and open the first cell - which is combo box and set focus.
I have tried the following but it does not work.. any ideas?  thanks

 

this.gridPO_det.ScrollIntoViewAsync(new_det

 

, (f) =>

{

 

GridViewRow row = f as GridViewRow;

 

 

if (row != null)

 

{

 

GridViewCell cell = row.Cells[0] as GridViewCell;

 

cell.BeginEdit();

Dispatcher.BeginInvoke(

new Action(() =>

 

{

((

RadComboBox)cell.GetEditingElement()).IsDropDownOpen = true;

 

}));

}

});

Maya
Telerik team
 answered on 26 Oct 2010
1 answer
156 views
I have several custom WPF controls whose visual representations are defined by a XAML template. My goal is to define a RadContextMenu in a ResourceDictionary and then, in code, assign it to be the context menu for my custom controls, similary to the following:

ResourceDictionary resourceDictionary = new ResourceDictionary();
            resourceDictionary.Source = new Uri(
                "MyLibrary;component/Resources/Resources.xaml", UriKind.Relative);
  
            Grid mainGrid = Template.FindName("mainGrid", this) as Grid;
            if(mainGrid != null)
            {
                RadContextMenu.SetContextMenu(this, (RadContextMenu)resourceDictionary["DefaultControlContextMenu"]);
            }

At runtime, the RadContextMenu gets assigned correctly, but whenever I right-click on my custom control the following exception is thrown:

System.InvalidOperationException: Cannot perform action because the specified Storyboard was not applied to this object for interactive control.

I've noticed that others have gotten a similar exception with the RadTreeView and RadTransitionControl, and I need to know what to do for a workaround on this. Is the problem related to the fact that I am using a control template?

Thanks,

Greg
Hristo
Telerik team
 answered on 26 Oct 2010
1 answer
71 views
I need to show a Confirm prompt one a user is finished editing a cell.

Here is my current CellEditEnded eventhandler:
private void gvAccounts_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{
    if (e.EditAction == Telerik.Windows.Controls.GridView.GridViewEditAction.Cancel)
        return;
 
    oldNickname = e.OldData.ToString();
    newNickname = e.NewData.ToString();
 
    // nothing has changed
    if (oldNickname == newNickname)
        return;
 
    RadWindow.Confirm("Are you sure you want to change this nickname to " + newNickname + "?", this.ChangeNickname);
}

oldNickname and newNickname are global variables so I can keep up with the new/old values.

however, when any button on the prompt is clicked (or anywhere on the screen is clicked) another CellEditEnded event is fired but e.OldData is the same as e.NewData which overwrites my global variables.

I don't understand why the second event is firing.
Maya
Telerik team
 answered on 26 Oct 2010
1 answer
112 views
Hi,

I am drawing a Rad Chart with multiple line series. And although while creating a series I explicitly write code to disable the connector:

 DataSeries lineSeries = new DataSeries();                
 SplineSeriesDefinition lineDataSeries = new SplineSeriesDefinition();
 LabelSettings settings = new LabelSettings();
 settings.ShowConnectors = false;
 settings.Distance = 10;                
 lineDataSeries.LabelSettings = settings;
.
.
.

Later I assign this series to the RadChart's default view. But still it doesn't disable the labels.

LineChartTrancheResults.DefaultView.ChartArea.DataSeries.Add(lineSeries )

Do I need to do something else?

Thanks,
Farhan
Evgenia
Telerik team
 answered on 26 Oct 2010
5 answers
180 views

Hi Telerik 

I have been looking at your trial program specifically using the Charting gauge's and the map 

one thing im struggling to figure out is how to map British postcodes as points on the map.

do you know of any reading or have anything provided to see how to map these, 

if i can get these working i may be able to swing my boss into buying the controls for our team

JAke

Mick D.
Top achievements
Rank 1
 answered on 25 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?