Telerik Forums
UI for WPF Forum
4 answers
122 views
Hi!


I'm having my UserControl to show Thumbnails (list of images) using transition control. Image changes one to another every 7 sec. and to achieve this I'm using a Timer. Next is a snipped code:

public partial class ctlPublicidad : UserControl
{
Timer m_objTemporizador = new Timer();
List<string> m_vaThumbNails = new List<string>();
 
public ctlPublicidad()
        {
this.InitializeComponent();
IndiceThumbnailActivo = -1;
}
 
// This is execute when UserControl is loaded
private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
MostrarSiguienteImagenThumbNail();
                                m_objTemporizador = new Timer(7000);
                                m_objTemporizador.Elapsed += new ElapsedEventHandler(Temporizador_Elapsed);
                                m_objTemporizador.Start();
}
 
void Temporizador_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            MostrarSiguienteImagenThumbNail();
        }
 
       private void MostrarSiguienteImagenThumbNail()
        {
            Random vnNumeroRandom = new Random();
            int vnEfecto = vnNumeroRandom.Next(1, 7);
            switch (vnEfecto)
            {
                case 1: TransitionControl.Transition = new MotionBlurredZoomTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 400);
                        break;
                case 2: TransitionControl.Transition = new FadeTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 3: TransitionControl.Transition = new LinearFadeTransition() { Angle = 0.3, Darker = 0.3, Thickness = 0.2 };
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 4: TransitionControl.Transition = new WaveTransition() { Angle = 0.5, Amplitude = 0.15 };
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 5: TransitionControl.Transition = new FlipWarpTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 6: TransitionControl.Transition = new SlideAndZoomTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 7: TransitionControl.Transition = new RollTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
            }
 
            TransitionControl.Content = new Image() { Source = new BitmapImage(new Uri(m_vaThumbNails[++IndiceThumbnailActivo], UriKind.RelativeOrAbsolute)) };
        }
}

First image is showed fine, but when timer elapsed is reached, exception is thrown when try to change to another transition effect. Error is:
"The calling thread can not access this object because the owner is another thread". How can I do to achieve this thumbnail???


thanks
ENTERPRISE INTERNATIONAL SAS
Top achievements
Rank 1
 answered on 09 Feb 2011
2 answers
86 views
Hi all

I want to make an editable grid in Row Details Template.. What I did is that from a Linq Query i fill the observable collection and bind the outer grid with it.. The outer grid shows the data in the grid.. Now when I select a row I want to open a new grid based on the selected row.. How will i do that also i want editable fields in this inner grid.. When i code this it throws an exception saying that as the data in the grid is from a linq query and the properties in linq query are readonly so they can not be edited.. I am very confused due to this.. Help me in solving this issue..

P.S> My linq query uses 3 to 4 joins.

 
Zeeshan
Top achievements
Rank 1
 answered on 09 Feb 2011
1 answer
552 views
I created custom column;
It works fine but when I am trying to clear a cell I am geting "Value Cannot be converted" validation error.
My binding is to the nullable double.
Please advise what to do.

thanks

  public class NumericTextBoxColumn :GridViewBoundColumnBase
    {
        public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
        {
            this.BindingTarget = NumericTextBox.TextProperty;
            NumericTextBox control = new NumericTextBox();
            control.SetBinding(this.BindingTarget, this.CreateValueBinding());
            return control;
        }

        private Binding CreateValueBinding()
        {
            Binding valueBinding = new Binding();
            valueBinding.Mode = BindingMode.TwoWay;
            valueBinding.NotifyOnValidationError = true;
            valueBinding.ValidatesOnExceptions = true;
            valueBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            valueBinding.Path = new PropertyPath(this.DataMemberBinding.Path.Path);

            return valueBinding;
        }
    }


where;

   public class NumericTextBox: TextBox
    {
       
        protected override void OnPreviewTextInput(System.Windows.Input.TextCompositionEventArgs e)
        {
            if(string.IsNullOrEmpty(e.Text))
            {
                e.Handled = true;
                return;
            }
           
            e.Handled = !AreAllValidNumericChars(e.Text);
            base.OnPreviewTextInput(e);
        }

        private bool AreAllValidNumericChars(string str)
        {
            foreach (char c in str)
            {
                if (c == '.' && base.Text.Contains(".")) return false;
                if (!(Char.IsNumber(c) || c=='.' )) return false;
            }

            return true;
        }

    }

Maya
Telerik team
 answered on 09 Feb 2011
1 answer
357 views
Hi,

How can i route the DropDownOpened event raised by the RadComboBox to a handler in the viewmodel?

Thanks.
George
Telerik team
 answered on 09 Feb 2011
1 answer
107 views
I have a RadDocking with two RadSplitContainers in it. In the first Container I have one Pane and in the second Container I have a DocumentHost with n Panes. How do I prevent the Panes from the DocumentHost from docking in the first RadSplitContainer (or force them to only dock in their "own" SplitContainer)?

My structure looks like this:

<telerik:RadDocking>
    <!-- Panel -->
    <telerik:RadSplitContainer MinWidth="265" MaxWidth="600" Width="350" Name="LeftContainer" InitialPosition="DockedLeft" Margin="0,-4,0,0">
        <telerik:RadPaneGroup BorderThickness="1">
            <telerik:RadPane Header="Title">
                Content
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>
     
    <!-- Tabs -->
    <telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer Margin="0,-3,0,0" BorderThickness="1">
            <telerik:RadPaneGroup>
                <telerik:RadPane Header="asdf">
                    aasdf asdf
                </telerik:RadPane>
                <telerik:RadPane Header="asdf">
                    aasdf asdf
                </telerik:RadPane>
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>
</telerik:RadDocking>
Konstantina
Telerik team
 answered on 09 Feb 2011
1 answer
246 views
Hi!
How can i create a template that works on every element in a kml file i load from my computer?

.cs:
Loading the kml file works fine:   

            try
            {
                FileStream streamResource = File.Open("c:\\mapsource\\wildlife.kml",FileMode.Open,FileAccess.Read);
                List<FrameworkElement> elements = Telerik.Windows.Controls.Map.KmlReader.Read(streamResource);


                foreach (FrameworkElement element in elements)
                {
                    this.informationLayer.Items.Add(element);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error: " + e);
            }

.xaml:
<StackPanel>
        <Label HorizontalContentAlignment="Center" Content="Map" Width="{Binding Source={StaticResource configSource}, Path=DefaultMapWidth}" Height="30" Background="Gray"></Label>
        <telerik:RadMap x:Name="radMap"  Width="{Binding Source={StaticResource configSource}, Path=DefaultMapWidth}" Height="{Binding Source={StaticResource configSource}, Path=DefaultMapHeight}"
                            MouseDragMode="Drag"
                            ZoomBarVisibility="Collapsed"
                            NavigationVisibility="Collapsed">
            <telerik:InformationLayer x:Name="informationLayer">
                <telerik:InformationLayer.ItemTemplate>
                    <DataTemplate>
                        <Grid telerik:MapLayer.BaseZoomLevel="5" >
                            
                        </Grid>
                    </DataTemplate>
                </telerik:InformationLayer.ItemTemplate>
                <!--<telerik:InformationLayer.Reader>
                    <telerik:MapShapeReader Source="c:/mapsource/Oil_Spills.kml" SourceType="Kml"/>
                </telerik:InformationLayer.Reader>-->
            </telerik:InformationLayer>
        </telerik:RadMap>
    </StackPanel>


KML:
Here's a part of the kml file that i'm using:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
        <Document>
        <name>wildlife-national-parks-india.kml</name>


        <Placemark>
        <name>Anshi National Park</name>
              <description>
                <![CDATA[
                  <p>Wildlife: Bonnet Macaque, Deer, Mouse Deer, Spotted Deer, Indian Bison, Malabar Civet, Malabar Giant Squirrel, Pangolin, Sloth Bear, Black Panther, Elephants, Tigers, Adjutant Stork, Ashy Woodswallow, Black-cre... </p>
                  <p>Plan your wildlife adventure holiday to <a href="http://www.world-wildlife-adventures.com/directory/india/wildlife-park.asp?sanctuary=Anshi+National+Park&state=Karnataka">Anshi National Park</a>, India...
                   read reviews by fellow wildlife enthusiasts, and share your own.  For information about other parks in India and the rest of the world visit: <a href="http://www.world-wildlife-adventures.com/">World Wildlife Adventures</a></p>
                ]]>
              </description>
        <Point>
        <coordinates>74.39598,15.07237,0</coordinates>
        </Point>
        </Placemark>
        <Placemark>
        <name>Balphakram National Park</name>
              <description>
                <![CDATA[
                  <p>Wildlife: Indian Elephant, Bengal Tiger, Leopard, Clouded Leopard, Wild Buffalo, Gaur (Indian Bison), Muntjac (Barking Deer), Hoolock (White-browed) Gibbon, Assamese Macaque, Pig-tailed Macaque, Capped Langur (... </p>
                  <p>Plan your wildlife adventure holiday to <a href="http://www.world-wildlife-adventures.com/directory/india/wildlife-park.asp?sanctuary=Balphakram+National+Park&state=Meghalaya">Balphakram National Park</a>, India...
                   read reviews by fellow wildlife enthusiasts, and share your own.  For information about other parks in India and the rest of the world visit: <a href="http://www.world-wildlife-adventures.com/">World Wildlife Adventures</a></p>
                ]]>
              </description>
        <Point>
        <coordinates>90.82664,25.25261,0</coordinates>
        </Point>
        </Placemark>


It's important that i'm able to format the name and description.
I did not find any examples on this, so i hope you can help.

Thanks in advance.
Andrey
Telerik team
 answered on 09 Feb 2011
1 answer
69 views

Hello,
I want that RadRibbonGroup exit after "Click"
 enent.
I have attached sample code here.

Thanks

 

</telerik:RadRibbonTab>
<telerik:RadRibbonTab x:Name="tab3" Header="num2">
<telerik:RadRibbonGroup Header="num2_1">
<telerik:RadRibbonButton Text="num2_1" Click="RadRibbonButton_Click_1"/>
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="num2_2">
<telerik:RadRibbonButton Text="num2_2" Click="RadRibbonButton_Click_1"/>
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="num2_3">
<telerik:RadRibbonButton Text="num2_3" Click="RadRibbonButton_Click_1"/>
</telerik:RadRibbonGroup>
</telerik:RadRibbonTab>

 

 

 

 

<telerik:RadRibbonTab x:Name="tab4" Header="num3">
<telerik:RadRibbonGroup Header="num3_1">
<telerik:RadRibbonButton Text="num3_1" Click="RadRibbonButton_Click_1"/>
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="num3_2">
<telerik:RadRibbonButton Text="num3_2" Click="RadRibbonButton_Click_1"/>
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="num3_3">
<telerik:RadRibbonButton Text="num3_3" Click="RadRibbonButton_Click_1"/>
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="num3_4">
<telerik:RadRibbonButton Text="num3_4" Click="RadRibbonButton_Click_1"/>
</telerik:RadRibbonGroup>

 

 

 

 

</telerik:RadRibbonTab>
</telerik:RadRibbonBar>

 

 

 

 

Petar Mladenov
Telerik team
 answered on 08 Feb 2011
1 answer
68 views
hi, is it possible to change the borderstyle of a radgridview according to a cell value?
Vanya Pavlova
Telerik team
 answered on 08 Feb 2011
1 answer
155 views
I have enabled Column Resizing (CanUserResizeColumns="True") for my GridView.  When I attempt to resize the columns I see the left and right arrow while hovering over the column edge.  When I click and drag the mouse to resize the column, the column resize a couple of pixels and then the whole column header starts to drag like when you re-order the columns. My GridView is defined as follows:

<telerik:RadGridView x:Name="gridViewAccounts" Grid.Column="1" Grid.Row="2" telerikGridViewFilter:CustomFilterRow.IsEnabled="False" RowDetailsTemplate="{StaticResource AccountRowDetailsTemplate}" ColumnWidth="*" HorizontalAlignment="Stretch" SelectionMode="Extended" telerikDragDrop:RadDragAndDropManager.AllowDrag="True" telerikDragDrop:RadDragAndDropManager.AllowDrop="True" Loaded="gridViewAccounts_Loaded" AutoGenerateColumns="False" CanUserFreezeColumns="False" SelectionUnit="FullRow" AddingNewDataItem="gridViewAccounts_AddingNewDataItem" ShowInsertRow="False" RowDetailsVisibilityMode="Collapsed" Pasting="gridViewAccounts_Pasting" Copying="gridViewAccounts_Copying" CanUserResizeColumns="True" AllowDrop="True">

This may be related to another problem I am experiencing.

http://www.telerik.com/community/forums/wpf/gridview/filtering-dialog-immediately-closes.aspx

 

 

 

 

 

 

 

 

 

Ivan Ivanov
Telerik team
 answered on 08 Feb 2011
1 answer
100 views
I am using a slider with selectionRange enabled as well as well as with visible handles. In the control template I can see that those arrow buttons are reapeatButtons, however they seem to have behaviour of the standard button (repeat doesn't work). So if I press and hold the arrow key, it doesn't seem to fire multiple click events.
Petar Mladenov
Telerik team
 answered on 08 Feb 2011
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?