WPF How to wrap text in DataGrid after grouping2019 Community Moderator ElectionHow do I use WPF bindings with RelativeSource?Does my code demonstrate good WPF practice?How do I exit a WPF application programmatically?combo box inside a user control disappears when style is applied in wpfHow can I wrap text in a label using WPF?How to implement IDataErrorInfo on string indexers databinding?WPF text Wrap vs WrapWithOverflowData Binding in a WPF User ControlWPF DataGrid Customizing both RowStyle and CellStyleNavigate to other page IocContainers and MVVM light

Professor forcing me to attend a conference, I can't afford even with 50% funding

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Specifying a starting column with colortbl package and xcolor

I reported the illegal activity of my boss to his boss. My boss found out. Now I am being punished. What should I do?

Is it possible to avoid unpacking when merging Association?

Can one live in the U.S. and not use a credit card?

I can't die. Who am I?

Signed and unsigned numbers

How do spaceships determine each other's mass in space?

What is better: yes / no radio, or simple checkbox?

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

Windows Server Data Center Edition - Unlimited Virtual Machines

What is the population of Romulus in the TNG era?

Is it possible to find 2014 distinct positive integers whose sum is divisible by each of them?

What do you call someone who likes to pick fights?

After `ssh` without `-X` to a machine, is it possible to change `$DISPLAY` to make it work like `ssh -X`?

Rationale to prefer local variables over instance variables?

Proving a statement about real numbers

Dynamic Linkage of LocatorPane and InputField

Virginia employer terminated employee and wants signing bonus returned

The meaning of ‘otherwise’

Why does cron require MTA for logging?

Can the alpha, lambda values of a glmnet object output determine whether ridge or Lasso?

Shifting between bemols and diesis in the key signature



WPF How to wrap text in DataGrid after grouping



2019 Community Moderator ElectionHow do I use WPF bindings with RelativeSource?Does my code demonstrate good WPF practice?How do I exit a WPF application programmatically?combo box inside a user control disappears when style is applied in wpfHow can I wrap text in a label using WPF?How to implement IDataErrorInfo on string indexers databinding?WPF text Wrap vs WrapWithOverflowData Binding in a WPF User ControlWPF DataGrid Customizing both RowStyle and CellStyleNavigate to other page IocContainers and MVVM light










0















Below is my code and I use WPF Grouping method to generate different groups based on the column:



 <DataGrid ItemsSource="Binding Source=StaticResource cvsDataTable" Name="oriontable" IsReadOnly="True" AutoGeneratingColumn="OnAutoGeneratingColumn"
AlternatingRowBackground="#DFECFA" VirtualizingPanel.IsVirtualizingWhenGrouping="True" Foreground="Black" FontFamily="Arial" FontSize="14" RowHeight="25" MaxColumnWidth="250"
CanUserSortColumns="False" ColumnHeaderHeight="30" MouseLeftButtonDown="Oriontable_MouseLeftButtonDown"
HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" AutomationProperties.IsOffscreenBehavior="Onscreen" Grid.ColumnSpan="4" >
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="Binding Path=Name" TextWrapping="WrapWithOverflow"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="x:Type GroupItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="x:Type GroupItem">
<Expander Background="SteelBlue" BorderBrush="SteelBlue" BorderThickness="1,1,1,1" FontFamily="Arial" FontSize="12"
Foreground="Black" VerticalAlignment="Bottom" Margin="3,3,3,3" >
<Expander.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5,5,5,5" >
<TextBlock Text="View: " Background="SteelBlue" Foreground="White" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Binding Path=Name" Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Count: " Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="15,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Binding Path=ItemCount" Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Items" Background="SteelBlue" Foreground="White" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" VerticalAlignment="Center"/>
<Button Grid.Column="4" Grid.Row="0" Margin="5,0,0,0" VerticalAlignment = "Center" Background="Transparent" BorderThickness="0" Click="Csvbutton_Click" HorizontalAlignment="Left" Width="30" Grid.ColumnSpan="2" >
<Image Height="25" Width="30" Source="StaticResource MicronExcelIcon32" />
</Button>
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
</DataGrid>


However, i cannot find a way to wrap the cell value in the datagrid.



Hope someone can help on this. Thanks!










share|improve this question






















  • What value are you trying to wrap? Please provide an image that demonstrates your issue.

    – mm8
    Mar 6 at 15:36















0















Below is my code and I use WPF Grouping method to generate different groups based on the column:



 <DataGrid ItemsSource="Binding Source=StaticResource cvsDataTable" Name="oriontable" IsReadOnly="True" AutoGeneratingColumn="OnAutoGeneratingColumn"
AlternatingRowBackground="#DFECFA" VirtualizingPanel.IsVirtualizingWhenGrouping="True" Foreground="Black" FontFamily="Arial" FontSize="14" RowHeight="25" MaxColumnWidth="250"
CanUserSortColumns="False" ColumnHeaderHeight="30" MouseLeftButtonDown="Oriontable_MouseLeftButtonDown"
HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" AutomationProperties.IsOffscreenBehavior="Onscreen" Grid.ColumnSpan="4" >
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="Binding Path=Name" TextWrapping="WrapWithOverflow"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="x:Type GroupItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="x:Type GroupItem">
<Expander Background="SteelBlue" BorderBrush="SteelBlue" BorderThickness="1,1,1,1" FontFamily="Arial" FontSize="12"
Foreground="Black" VerticalAlignment="Bottom" Margin="3,3,3,3" >
<Expander.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5,5,5,5" >
<TextBlock Text="View: " Background="SteelBlue" Foreground="White" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Binding Path=Name" Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Count: " Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="15,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Binding Path=ItemCount" Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Items" Background="SteelBlue" Foreground="White" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" VerticalAlignment="Center"/>
<Button Grid.Column="4" Grid.Row="0" Margin="5,0,0,0" VerticalAlignment = "Center" Background="Transparent" BorderThickness="0" Click="Csvbutton_Click" HorizontalAlignment="Left" Width="30" Grid.ColumnSpan="2" >
<Image Height="25" Width="30" Source="StaticResource MicronExcelIcon32" />
</Button>
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
</DataGrid>


However, i cannot find a way to wrap the cell value in the datagrid.



Hope someone can help on this. Thanks!










share|improve this question






















  • What value are you trying to wrap? Please provide an image that demonstrates your issue.

    – mm8
    Mar 6 at 15:36













0












0








0








Below is my code and I use WPF Grouping method to generate different groups based on the column:



 <DataGrid ItemsSource="Binding Source=StaticResource cvsDataTable" Name="oriontable" IsReadOnly="True" AutoGeneratingColumn="OnAutoGeneratingColumn"
AlternatingRowBackground="#DFECFA" VirtualizingPanel.IsVirtualizingWhenGrouping="True" Foreground="Black" FontFamily="Arial" FontSize="14" RowHeight="25" MaxColumnWidth="250"
CanUserSortColumns="False" ColumnHeaderHeight="30" MouseLeftButtonDown="Oriontable_MouseLeftButtonDown"
HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" AutomationProperties.IsOffscreenBehavior="Onscreen" Grid.ColumnSpan="4" >
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="Binding Path=Name" TextWrapping="WrapWithOverflow"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="x:Type GroupItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="x:Type GroupItem">
<Expander Background="SteelBlue" BorderBrush="SteelBlue" BorderThickness="1,1,1,1" FontFamily="Arial" FontSize="12"
Foreground="Black" VerticalAlignment="Bottom" Margin="3,3,3,3" >
<Expander.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5,5,5,5" >
<TextBlock Text="View: " Background="SteelBlue" Foreground="White" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Binding Path=Name" Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Count: " Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="15,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Binding Path=ItemCount" Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Items" Background="SteelBlue" Foreground="White" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" VerticalAlignment="Center"/>
<Button Grid.Column="4" Grid.Row="0" Margin="5,0,0,0" VerticalAlignment = "Center" Background="Transparent" BorderThickness="0" Click="Csvbutton_Click" HorizontalAlignment="Left" Width="30" Grid.ColumnSpan="2" >
<Image Height="25" Width="30" Source="StaticResource MicronExcelIcon32" />
</Button>
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
</DataGrid>


However, i cannot find a way to wrap the cell value in the datagrid.



Hope someone can help on this. Thanks!










share|improve this question














Below is my code and I use WPF Grouping method to generate different groups based on the column:



 <DataGrid ItemsSource="Binding Source=StaticResource cvsDataTable" Name="oriontable" IsReadOnly="True" AutoGeneratingColumn="OnAutoGeneratingColumn"
AlternatingRowBackground="#DFECFA" VirtualizingPanel.IsVirtualizingWhenGrouping="True" Foreground="Black" FontFamily="Arial" FontSize="14" RowHeight="25" MaxColumnWidth="250"
CanUserSortColumns="False" ColumnHeaderHeight="30" MouseLeftButtonDown="Oriontable_MouseLeftButtonDown"
HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" AutomationProperties.IsOffscreenBehavior="Onscreen" Grid.ColumnSpan="4" >
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="Binding Path=Name" TextWrapping="WrapWithOverflow"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="x:Type GroupItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="x:Type GroupItem">
<Expander Background="SteelBlue" BorderBrush="SteelBlue" BorderThickness="1,1,1,1" FontFamily="Arial" FontSize="12"
Foreground="Black" VerticalAlignment="Bottom" Margin="3,3,3,3" >
<Expander.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5,5,5,5" >
<TextBlock Text="View: " Background="SteelBlue" Foreground="White" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Binding Path=Name" Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Count: " Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="15,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Binding Path=ItemCount" Foreground="White" Background="SteelBlue" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" Width="Auto" VerticalAlignment="Center" />
<TextBlock Text="Items" Background="SteelBlue" Foreground="White" FontFamily="Arial" FontSize="16" FontWeight="Bold" Margin="5,0,0,0" VerticalAlignment="Center"/>
<Button Grid.Column="4" Grid.Row="0" Margin="5,0,0,0" VerticalAlignment = "Center" Background="Transparent" BorderThickness="0" Click="Csvbutton_Click" HorizontalAlignment="Left" Width="30" Grid.ColumnSpan="2" >
<Image Height="25" Width="30" Source="StaticResource MicronExcelIcon32" />
</Button>
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
</DataGrid>


However, i cannot find a way to wrap the cell value in the datagrid.



Hope someone can help on this. Thanks!







c# wpf grouping wrap






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 6 at 14:29









Eva CheungEva Cheung

459




459












  • What value are you trying to wrap? Please provide an image that demonstrates your issue.

    – mm8
    Mar 6 at 15:36

















  • What value are you trying to wrap? Please provide an image that demonstrates your issue.

    – mm8
    Mar 6 at 15:36
















What value are you trying to wrap? Please provide an image that demonstrates your issue.

– mm8
Mar 6 at 15:36





What value are you trying to wrap? Please provide an image that demonstrates your issue.

– mm8
Mar 6 at 15:36












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55025455%2fwpf-how-to-wrap-text-in-datagrid-after-grouping%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55025455%2fwpf-how-to-wrap-text-in-datagrid-after-grouping%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

Алба-Юлія

Захаров Федір Захарович