Telerik Forums
UI for WPF Forum
3 answers
92 views
Hello.  I'm using the RadNumericUpDown for entering measurements.  I've set the control's decimal places property to 3 (using a binding to a business object property).  when the control has no value (meaning the value I'm binding to is null), and the control's text itself is empty, the user is able to enter a number such as ".890" without the leading 0.  However, when there is already a value in the control, such as "123.432" and the user selects the control, either by tab or by mouse click.  THe user must type in a leading 0 in order to enter a value less then 1, such as "0.890".

My client wants to be able to enter values without needing a leading 0.  I've tried handling the "GotFocus" event, and clearing the RadNumericUpDown.ValueProperty, or setting my business object's binded value to null.  However, these changes do not take effect until the user leaves the control.  Thus we get the weird behavior of the control clearing when the user leaves the control, instead of when they enter it.

Any ideas would be great.  Thanks

Joshua
Boyan
Telerik team
 answered on 17 Dec 2009
3 answers
373 views
Hi Team,

I want to align content of RadNumericUpDown to Left align. I have tried HorizontalContentAlignment="Left", but it doesn't work. Please suggest needful.

Thanks.

Sample:
File name: window1.xaml
XAML Content:
<Window x:Class="TelerikUpDown.Window1"
    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="Window1" Height="300" Width="300">
    <Grid>
        <telerik:RadNumericUpDown Name="NumUpDown" Height="25"
                                  HorizontalContentAlignment="Left"
                                  SmallChange="1" Minimum="1" Maximum="10" Value="2"
                                  BorderThickness="0" LargeChange="5" ValueFormat="Numeric"
                                  Width="150">
        </telerik:RadNumericUpDown>
    </Grid>
</Window>
Dimitrina
Telerik team
 answered on 17 Dec 2009
2 answers
134 views

For some strange reason, the gridview edit mode for a column that is string binded, accepts only numeric values. What could be wrong

 <telerik:RadGridView Name="rgvSiteDetails" Margin="10,10,10,10" Height="340" RowIndicatorVisibility="Collapsed"   
                    ShowGroupPanel="False" AutoGenerateColumns="False" Visibility="Visible" Background="Transparent" 
                    AutoGenerateHierarchyFromDataSet="False" BorderBrush="LightGray" CanUserFreezeColumns="False" CanUserInsertRows="False" 
                    HorizontalContentAlignment="Stretch" ShowColumnHeaders="True" IsFilteringAllowed="False"   
                    VerticalGridlinesBrush="LightGray" > 
                    <telerik:RadGridView.Columns> 
                        <telerik:GridViewDataColumn UniqueName="IsSelected" DataMemberBinding="{Binding IsSelected}" Header="" Width="30" /> 
                        <telerik:GridViewDataColumn UniqueName="SiteSequence" Header="" Width="30" DataMemberBinding="{Binding SiteSequence}" /> 
                        <telerik:GridViewDataColumn UniqueName="SiteName" Header="SiteName" DataMemberBinding="{Binding SiteName}"  Width="120" /> 
                        <telerik:GridViewDataColumn UniqueName="SiteShortName" Header="SiteShortName" DataMemberBinding="{Binding SiteShortName}"  Width="120"/>  
                        <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="ReceivedDate" IsVisible="True" Header="Received Date" Width="80"  DataMemberBinding="{Binding ReceivedDate}"  /> 
                        <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="PatientLastName" Header="Patient Last Name" IsVisible="True" Width="120"  DataMemberBinding="{Binding PatientLastName}"  /> 
                          
                        <telerik:GridViewDataColumn x:Name="gdcCassetteId" UniqueName="CassetteID" IsVisible="False" Header="Cassette Id" Width="80"  DataMemberBinding="{Binding CassetteID}" /> 
                          
                        <telerik:GridViewDataColumn x:Name="gdcSlideId" UniqueName="DisplayName" Header="Display Name" IsVisible="False" DataMemberBinding="{Binding DisplayName}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcDisplayName" UniqueName="DisplayName" Header="Display Name" IsVisible="False" DataMemberBinding="{Binding DisplayName}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcProcedureName" UniqueName="ProcedureName" Header="Procedure Name" IsVisible="False" DataMemberBinding="{Binding DisplayName}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcLevelInfo" UniqueName="LevelInfo" Header="Level Info" IsVisible="False" DataMemberBinding="{Binding DisplayName}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcmagazineid" UniqueName="magazineid" IsVisible="False" Header="Magazine Id"  DataMemberBinding="{Binding magazineid}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcbin" UniqueName="bin" Header="Exit Bin" IsVisible="False"   DataMemberBinding="{Binding bin}"  /> 
 
                    </telerik:RadGridView.Columns> 
                </telerik:RadGridView> 
Below is the code behind

private void rgvSiteDetails_CurrentCellChanged(object sender, GridViewCurrentCellChangedEventArgs e)  
        {  
            this.rgvSiteDetails.BeginEdit();  
        } 
 SharedData.lstSelectedCaseData = new ObservableCollection<SharedData.SelectedCaseData>();  
 
                rgvSiteDetails.DataLoaded += new EventHandler<EventArgs>(rgvSiteDetails_DataLoaded);  
               foreach (CaseDataCase item in SharedData.objCurrent.Items)  
                        {  
                            if (item.Specimen != null)  
                                foreach (CaseDataCaseSpecimen item2 in item.Specimen)  
                                {  
                                    SharedData.SelectedCaseData a = new SharedData.SelectedCaseData();  
                                    a.CaseId = item.CaseId;  
                                    a.AccessionNumber = item.AccessionNumber;  
                                    a.ReceivedDate = item.ReceivedDate;  
                                    a.PatientLastName = item.Patient[0].PatientLastName;  
                                    a.IsSelected = true;  
                                    a.SiteName = item2.SiteName;  
                                    a.SiteSequence = item2.SiteSequence;  
                                    a.SiteShortName = item2.SiteShortName;  
                                    a.SiteID = item2.SiteID;  
                                    SharedData.lstSelectedCaseData.Add(a);         
                                }  
                              
                        }  
                        rgvSiteDetails.ItemsSource = SharedData.lstSelectedCaseData; 

void rgvSiteDetails_DataLoaded(object sender, EventArgs e)  
        {  
            try 
            {  
                SharedData.Log.Info("Entering rgvSiteDetails_DataLoaded");  
                rgvSiteDetails.ExpandAllGroups();  
                SharedData.Log.Info("Exiting rgvSiteDetails_DataLoaded");  
            }  
            catch (Exception ex)  
            {  
                SharedMethods.HandleExceptions(ex);  
            }  
              
        } 

Any help would be highly appreciated.
Pooran
Pooran
Top achievements
Rank 1
 answered on 17 Dec 2009
2 answers
133 views
Hi, so I'm wondering how I can check for that and disable the drop under some circumstances. I've already tried all the drag and drop events that make sense to me in the TreeView (DragEnter, DragStarted DragOver, PreviewDragEnter, PreviewDragStarted, PreviewDragOver), so when I start dragging and I move the dragged object around, none of this events get fired. I also tried an approach with the RadDragAndDropManager here:


But to my surprise, the OnDropInsideTreeViewDropQuery event never got fired. Am I missing something here?

What I want to do is pretty simple. I have several types of objects in my treeview, say:

Junkyards
    Junkyard 1
         Cars
            Toyota Corola
            Nissan Sentra
         Furniture
            Stove
            Desk
         Computers
            Dell Inspiron
            HP a2921
    Junkyard 2
         Cars
            Toyota Corola
            Nissan Sentra
         Furniture
            Stove
            Desk
         Computers
            Dell Inspiron
            HP a2921

So if the user drags a car from Junkyard1 to Junkyard2 and hovers it over Computers, basically I wan't to show a NO cursor, but if he does drag it over the Cars node, then it should allow him to drop there. The Junkyards cannot be dragged, so I need to check if the user is trying to drag a Junkyard and not allow him to.

Please keep in mind that I'm not doing the TreeView filling in code or XAML, the data is coming from an XML document, so I can't just go to each RadTreeViewItem and set the IsDropAllowedProperty to false, it has to be done programmatically through the events.

Thanks!
Lauren Nickerson
Top achievements
Rank 1
 answered on 16 Dec 2009
3 answers
248 views
when i set the tabitem foreground to black and i click on an other tab it's foreground becomes white,

how can i stop this behavior?
Dimitrina
Telerik team
 answered on 16 Dec 2009
3 answers
138 views
Hello,

I have a treeview control and want to check the nodes from code dynamically according to the values coming from the database. Below is my xaml
<telerik:RadTabItem.Content> 
      <telerik:RadTreeView Name="TreeViewCategories" SelectionMode="Extended" 
            IsLineEnabled="True" ItemsOptionListType="CheckList" IsOptionElementsEnabled="True" 
            IsRootLinesEnabled="True" IsTriStateMode="True" > 
            <telerik:RadTreeView.ItemTemplate> 
                  <HierarchicalDataTemplate ItemsSource="{Binding Path=ChildCategories, Mode=TwoWay}">  
                         <StackPanel>                                          
                                <TextBlock  Text="{Binding Name}" Name="textblockName"></TextBlock> 
                         </StackPanel> 
                  </HierarchicalDataTemplate> 
            </telerik:RadTreeView.ItemTemplate> 
      </telerik:RadTreeView> 
</telerik:RadTabItem.Content> 

I try your solution at this page
http://www.telerik.com/community/forums/wpf/treeview/how-to-check-uncheck-items-from-code-behind.aspx

But could not resolve it. When i try the method mentioned at the solution it gives an error. The error comes from the if statement
"Object reference not set to an instance of an object". Below is the code.
void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)  
        {  
            if ((sender as RadTreeView).ItemContainerGenerator.Status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated)  
            {  
                foreach (RadTreeViewItem item in TreeViewCategories.Items)  
                {  
                    item.CheckState = System.Windows.Automation.ToggleState.On;  
                }  
            }  
        } 

Can you suggest a solution please.

Regards.
Bobi
Telerik team
 answered on 16 Dec 2009
2 answers
62 views
Hello,

I'd like to know if there exists a way, to show each of related tables while grouping in separate tab of RadTabControl.
I mean that I would like to do the same as in the WPF DataGridView Demo. If you have the Demo , just run it (DataGrid), and you will see that each related table is in TabControl.

Thank you
Wael
Wael Slaman
Top achievements
Rank 1
 answered on 16 Dec 2009
2 answers
228 views

Hello everybody.
I have a RadGridView  whith three column teo of whic are displayed and edited using cell templates with a radComboBox and a TextBox

The following is the XAML code

<telerik:RadGridView x:Name="radGridDiscounts"  HorizontalAlignment="Left" Height="150" Width ="500" AutoGenerateColumns="False" ShowGroupPanel="False" MultipleSelect="False" ColumnsWidthMode="Fill" ItemsSource=""> 
    <telerik:RadGridView.Columns
        
<telerik:GridViewDataColumn Header="Descrizione" HeaderTextAlignment="Center" Width="200"
             DataMemberBinding="{Binding Description}" IsReadOnly="True" IsFilterable="False" />
       
<telerik:GridViewDataColumn Header="Tipologia sconto" HeaderTextAlignment="Center" Width="120" IsFilterable="False">
            <
telerik:GridViewColumn.CellTemplate>
                <DataTemplate>
                    <telerik:RadComboBox x:Name="radComboOperations"                                                                  
                                                              SelectionChanged
="radComboOperations_SelectionChanged   Loaded="radComboOperations_Loaded"
                                                              DisplayMemberPath
="Description" SelectedValuePath="Id"/>
                
</DataTemplate>
           
</telerik:GridViewColumn.CellTemplate>
      </telerik:GridViewDataColumn>
      <telerik:GridViewDataColumn Header="Valore" HeaderTextAlignment="Center" Width="75" IsFilterable="False" IsSortable="False"
        
<telerik:GridViewColumn.CellTemplate>
            <DataTemplate>
                <TextBox x:Name="textBoxValue" TextChanged="textBoxValue_TextChanged" Loaded="textBoxValue_Loaded"/>
           
</DataTemplate>
      
</telerik:GridViewColumn.CellTemplate>
    
</telerik:GridViewDataColumn>
  
</telerik:RadGridView.Columns>
</telerik:RadGridView>

So for every record displayed in the radGridView, "radComboOperations" is a radcombobox displayed in one cell template and "textBoxValue" is a textBox of the other cell template.

During the "_Loaded" operations of both controls I initialize properly the values must be displayed.
And there is no problem at all until now.

What do I have to do is to change Text or IsEnabled properties of "textBoxValue" of the corresponding Item ot the radGirdView, when a radComboOperations_SelectionChanged event of "radComboOperations" is raised.

The following is my function for the event

private void radComboOperations_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
   
RadComboBox comboBox = (RadComboBox)sender;
   
if (comboBox!=null)
   
{
        MyDTO dto = (MyDTO)comboBox.DataContext;
       
MyOperation Operation = (MyOperation)comboBox.SelectedItem;
       
if (Operation.Id == Guid.Empty)
        {
             //need help here where
            //I have to disable the textBoxValue of the corresponding item of the radGridView
            //where and how can I find the textBoxValue text box of the cell template??
        }
    }
}

I will thank a lot everyone may help me!!
Bye everybody
Nick

Nick
Top achievements
Rank 1
 answered on 16 Dec 2009
4 answers
381 views
All,

I am using WPF GridView and want to attach a ContextMenu with the GridView. What I want is that when user right-clicks any row a ContextMenu appears with various options like Edit, Delete etc.

I have added a ContextMenu to the RadGridView.ContextMenu however when I right-click on the row is de-selected and the menu appears.

I want to row to be selected and in the code want to get hold of the object bound to the that row.

I would really appreciate for any help.

Regards,
Tahir
Vlad
Telerik team
 answered on 16 Dec 2009
1 answer
150 views
Hello,
     I need to duplicate the selected row on the grid 1-N times. The duplicates will appear below the selected row. The grid is bound to a datatable in a dataset. The only way I've figured to do this is:

for (int i = 0; i <number of duplicates>; i++)
{
  Datarow dr = datatablename.NewRow();
  dr.ItemArray = datatablename.Rows[<position of row in grid to duplicate>].ItemArray;
  datatablename.Rows.InsertAt(dr, <position of row in grid to duplicate> + 1);
  dr = null;
}

Is this the correct way to duplicate rows?

Thanks
Vlad
Telerik team
 answered on 16 Dec 2009
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?