Telerik Forums
UI for WPF Forum
5 answers
494 views

I currently implemented Excel Export behind code, I'm trying to have it be implemented in the ViewModel Instead. How abouts would I do that?

 

 

 

        private void MenuItem_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                string content;

                var extension = "xml";
                content = DrillThroughGridView.ToExcelML(true);

                string path = String.Format("Export.{0}", extension);

                if (File.Exists(path))
                {
                    File.Delete(path);
                }

                using (FileStream fs = File.Create(path))
                {
                    Byte[] info = Encoding.Default.GetBytes(content);
                    fs.Write(info, 0, info.Length);
                }

                Process.Start(path);
            }
            catch (Exception)
            {
                Notification.Error("Process Busy", "Please exit excel instance.");
            }
        }​

 

 

Dinko | Tech Support Engineer
Telerik team
 answered on 25 Aug 2017
2 answers
83 views

Hello I need to Maximize RadTileViewItem Programatically  Using the MVVM concept 

But when I run it doesn't happens 

 

 

My XAML is this :

 <telerik:RadTileViewItem x:Name="rdTileViewMain" Header="Main" RestoredHeight="100" MinimizedHeight="200" RestoredWidth="80" Style="{StaticResource RadTileViewItemStyle}" BorderBrush="{x:Null}" SnapsToDevicePixels="True" Foreground="#FFFDFBFB" TileState="{Binding TileStaterdTileViewMain}">
                                <Grid x:Name="grdMain">
                                    <Grid x:Name="grdProcessInfo" Visibility="{Binding GrdProcessInfoVisibility}">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="576.8"/>
                                            <RowDefinition />
                                        </Grid.RowDefinitions>

                                        <Border x:Name="pnlShopOrder" CornerRadius="5" Margin="5,10,5,462.8" BorderBrush="{StaticResource AccentBrush}" BorderThickness="1" Grid.Column="0" Grid.Row="0">
                                            <TextBlock x:Name="txtShopOrder" Grid.Column="1" Grid.Row="0" Style="{StaticResource ProcessInfoMainStyle}" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding ProcessShopOrder}" TextWrapping="Wrap"></TextBlock>
                                        </Border>
                                        <Border x:Name="pnlInfoMeter" CornerRadius="5" Margin="0,119,0,354.8" BorderBrush="{StaticResource AccentBrush}" BorderThickness="1" Grid.Column="0">
                                            <TextBlock x:Name="txtInfoMeter" Grid.Column="1" Grid.Row="0" Style="{StaticResource ProcessInfoMainStyle}" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding ProcessInfoMeter}" TextWrapping="Wrap"></TextBlock>
                                        </Border>
                                        <Border x:Name="pnlProcessStepStatus" CornerRadius="5" Margin="0,234,-0.2,228.8" BorderBrush="{StaticResource AccentBrush}" BorderThickness="1" Grid.Column="0" Grid.ColumnSpan="2">
                                            <TextBlock x:Name="txtProcessStepStatus" Grid.Column="1" Grid.Row="0" Style="{StaticResource ProcessInfoMainStyle}" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding ProcessStepStatus}" TextWrapping="Wrap"></TextBlock>
                                        </Border>

                                        <Border x:Name="pnlProcessStatus" CornerRadius="5" Margin="0,353,-0.2,109.8" BorderBrush="{StaticResource AccentBrush}" BorderThickness="1" Grid.Column="0" Grid.ColumnSpan="2">
                                            <TextBlock x:Name="txtProcessStatus" Grid.Column="1" Grid.Row="0" Style="{StaticResource ProcessInfoMainStyle}" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding ProcessStaus}" TextWrapping="Wrap"></TextBlock>
                                        </Border>
                                        <Border x:Name="pnlProcessImg" CornerRadius="5" Margin="5,5,-0.2,2.8" Background="White" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="0" Width="0">
                                            <Image x:Name="imgProcess" HorizontalAlignment="Left" VerticalAlignment="Top" Source="{Binding ProcessImageSource}" Height="200" />
                                        </Border>
                                    </Grid>
                                </Grid>
                            </telerik:RadTileViewItem>

 

Then in my mainWindowViewModel I have

private TileViewItemState _TileStaterdTileViewMain;

        public TileViewItemState TileStaterdTileViewMain
        {
            get {
                return _TileStaterdTileViewMain;
            }
            set {
                _TileStaterdTileViewMain = value;
                PropertyChanged(this, new PropertyChangedEventArgs("TileStaterdTileViewMain"));
            }

 private void RaiseUpUcShopOrdersButtonControl(object parameter)
        {
            TileStaterdTileViewMain = Telerik.Windows.Controls.TileViewItemState.Maximized;
   
        }

 

Can someone help me to know If I missing something?

Thanks 
        

 

Rodolfo
Top achievements
Rank 1
 answered on 25 Aug 2017
2 answers
104 views

Hello I will appreciate your help with the Next I need to Maximized RadTileViewItem Programatically, But it is not running 

 

My XAML

<telerik:RadTileViewItem x:Name="rdTileViewMain" Header="Main" RestoredHeight="100" MinimizedHeight="200" RestoredWidth="80" Style="{StaticResource RadTileViewItemStyle}" BorderBrush="{x:Null}" SnapsToDevicePixels="True" Foreground="#FFFDFBFB" TileState="{Binding TileStaterdTileViewMain}">

 

Then in my MainWindowViewModel:

     private TileViewItemState _TileStaterdTileViewMain;

     public TileViewItemState TileStaterdTileViewMain
        {
            get {
                return _TileStaterdTileViewMain;
            }
            set {
                _TileStaterdTileViewMain = value;
                PropertyChanged(this, new PropertyChangedEventArgs("TileStaterdTileViewMain"));
            }

        }

 

   private void RaiseUpUcShopOrdersButtonControl(object parameter)
        {
            TileStaterdTileViewMain = Telerik.Windows.Controls.TileViewItemState.Maximized;

}

 

Rodolfo
Top achievements
Rank 1
 answered on 25 Aug 2017
3 answers
168 views

Just now installed Telerik for WPF

Opening Visual Studio, creating project Telerik C# WPF Application, selecting "Blank" and "Finish".

Opening MainWindow.xaml, dragging RadRichTextBox from toolbox and dropping into Grid.

But here is Object reference not set in output log. When running - it crashes. Point.

 

RadButton works correctly.

Result code is here: https://pastebin.com/yVSNDbMH

Visual Studio is 2017

OS is Windows Server 2012

Locale is ru-RU

Telerik Installer is TelerikUIForWpfSetup_2017_3_0814_1.exe

C:\Program Files (x86)\Telerik\UI for WPF R2 2017\Binaries\WPF40\Telerik.Windows.Controls.RichTextBoxUI.dll file version is 2017.2.614.40

 

If you have different version and haven't problem, please give me installer or just this DLL, I'll try fix or search a bug with .NET Reflector

Peshito
Telerik team
 answered on 25 Aug 2017
11 answers
123 views
Your color Themes (VisualStudio 2013,Office2013,Windows 8 touch,Windows 8,Expression Dark, ... e.t.c) give not very rich color expression. For example, RadTreeListView is looked as in RadTreeListView.PNG file attached. What about your Green Theme - it is somewhat dark. Do you have any means for a variety of coloring?
Martin
Telerik team
 answered on 25 Aug 2017
1 answer
247 views

I have a RadAutoCompleteBox in RadGridView CellEditTemplate

public class AutoCompleteCell : RadAutoCompleteBox
{
    public AutoCompleteCell()
    {
        SelectionMode = AutoCompleteSelectionMode.Single;
        Unloaded += unloaded;
        Loaded += loaded;
    }
 
    private void loaded(object sender, RoutedEventArgs e)
    {
        //all has value
        string searchText = SearchText;
        object selectedItem = SelectedItem;
    }
 
    private void unloaded(object sender, RoutedEventArgs e)
    {
        string searchText = SearchText; //has value
        object selectedItem = SelectedItem; //no value
    }
}

 

SearchText is in dropdown ItemsSource, when I click the cell and enter edit mode, Loaded event fired and both SearchText and SelectedItem has value, but when I just press Esc to exit edit mode and in Unloaded event, SearchText still has value but SelectedItem is null.

Why this happened and how to fix it? Thanks.

<controls:AutoCompleteCell SelectedItem="{Binding Value, Mode=TwoWay}"  ItemsSource="{Binding Source, Mode=OneWay}" SearchText="{Binding Header, Mode=OneWay}" />

 

"Header" is returned from "Value".

 

 

 

Martin
Telerik team
 answered on 24 Aug 2017
7 answers
766 views
I would like to have a combobox that displays a text value when an item is selected but displays a grid with headers when the user clicks on the combobox (see attachment). I used the SelectionBoxTemplate to set the selected item text value and created a comboboxitem with a radgridview inside of it. I cannot use the SelectionBoxTemplate with the radgridview. Is there something wrong with how I have it setup? Also, the radgridview does not update the combobox when an item is selected? How can I make this function like a normal combobox? I don't need autocomplete.



<telerik:RadComboBox  SelectionBoxTemplate="{StaticResource SelectionBoxTemplate}" 
                                     IsEditable="True" Height="25" Width="200">
                    <telerik:RadComboBox.Items>
                        <telerik:RadComboBoxItem>
                            <telerik:RadComboBoxItem.Template>
                                <ControlTemplate>
                                    <telerik:RadGridView x:Name="RadGridView1" ShowGroupPanel="False" CanUserFreezeColumns="False" 
                                             RowIndicatorVisibility="Collapsed" IsReadOnly="True" 
                                             IsFilteringAllowed="False" ItemsSource="{Binding Tools}" 
                                             Width="200" Height="150" SelectedItem="{Binding Assignment, Mode=TwoWay}" AutoGenerateColumns="False">
                                        <telerik:RadGridView.Columns>
                                            <telerik:GridViewColumn Header="Item #" HeaderCellStyle="{StaticResource GridViewHeaderCellDefault}">
                                                <telerik:GridViewColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <TextBlock Style="{StaticResource TextBlockDefault}" Text="{Binding ItemNumber}" />
                                                    </DataTemplate>
                                                </telerik:GridViewColumn.CellTemplate>
                                            </telerik:GridViewColumn>
                                            <telerik:GridViewColumn Header="Tool Name" HeaderCellStyle="{StaticResource GridViewHeaderCellDefault}">
                                                <telerik:GridViewColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <StackPanel>
                                                            <TextBlock Style="{StaticResource TextBlockDefault}" Text="{Binding ToolName}"/>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </telerik:GridViewColumn.CellTemplate>
                                            </telerik:GridViewColumn>
                                        </telerik:RadGridView.Columns>
                                    </telerik:RadGridView>
                                </ControlTemplate>
                            </telerik:RadComboBoxItem.Template>
                        </telerik:RadComboBoxItem>
                    </telerik:RadComboBox.Items>
                </telerik:RadComboBox>
Kalin
Telerik team
 answered on 24 Aug 2017
1 answer
92 views
How to convert a list of System.Drawing.Color() to ChartView.Palette?
Stefan
Telerik team
 answered on 23 Aug 2017
4 answers
259 views

Hi, I'm struggling with a small display issue:

I have a bar chart with logarithmic Y scale. Evetyng is ok but if a bar has the value of 1 is not displayed. And this is correct because the logarithm of 1 is 0.
So there is no difference between a bar is not present and a bar with value 1.

I tried to set the minimum value of 0.5 but it's only displayed a gap between the X axis and the bars.

Is there a way to display small Bar when the values is 1? Like setting a small border or a padding?

Massimo
Top achievements
Rank 1
 answered on 23 Aug 2017
3 answers
255 views
IsPanEnabled="True" enables panning, but you need to hold down the Ctrl key. Is it possible to change this to the following?

Panning: Simple click
Selecting: Shift+click
Dinko | Tech Support Engineer
Telerik team
 answered on 23 Aug 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?